From 2396b9c4069c59aea19beea9ce59f96ec86a5ecf Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Sat, 26 Mar 2022 11:03:02 +0100 Subject: [PATCH 1/4] new: serialize/deserialize meshes on mesh descriptors --- CHANGELOG.md | 1 + src/compas/robots/model/geometry.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16a35d76a6f..7197fe2c5a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added optional `triangulated` flag to `Mesh.to_vertices_and_faces`. +* Added geometry information of active meshes to the serialization/deserialization of robot model's `MeshDescriptor`. ### Changed diff --git a/src/compas/robots/model/geometry.py b/src/compas/robots/model/geometry.py index 3622b61a35f..d097fef743e 100644 --- a/src/compas/robots/model/geometry.py +++ b/src/compas/robots/model/geometry.py @@ -173,6 +173,7 @@ def data(self): 'filename': self.filename, 'scale': self.scale, 'attr': _attr_to_data(self.attr), + 'meshes': [m.data for m in self.meshes], } @data.setter @@ -180,6 +181,7 @@ def data(self, data): self.filename = data['filename'] self.scale = data['scale'] self.attr = _attr_from_data(data['attr']) if 'attr' in data else {} + self.meshes = [Mesh.from_data(md) for md in data['meshes']] if 'meshes' in data else [] @classmethod def from_data(cls, data): From 6c493ff3410ba1512f521b02ad79bb6bf8d3a588 Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Sat, 26 Mar 2022 11:07:34 +0100 Subject: [PATCH 2/4] fix: detect mesh descriptor's new keys --- src/compas/robots/model/geometry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compas/robots/model/geometry.py b/src/compas/robots/model/geometry.py index d097fef743e..0f3c74a3b1d 100644 --- a/src/compas/robots/model/geometry.py +++ b/src/compas/robots/model/geometry.py @@ -366,6 +366,7 @@ def get_color(self): ('point', 'radius'): compas.geometry.Sphere, ('line', 'radius'): compas.geometry.Capsule, ('attr', 'filename', 'scale'): MeshDescriptor, + ('attr', 'filename', 'meshes', 'scale'): MeshDescriptor, } From b92116155c8056e5e1a0c2c01e9a3565e65d0d9e Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Mon, 28 Mar 2022 02:59:48 +0200 Subject: [PATCH 3/4] new: add GH component to draw any COMPAS object --- CHANGELOG.md | 2 ++ .../components/Compas_Frame/code.py | 20 -------------- .../components/Compas_Frame/icon.png | Bin 2759 -> 0 bytes .../components/Compas_Frame/metadata.json | 24 ----------------- .../components/Compas_FromJson/code.py | 3 +++ .../components/Compas_FromJson/icon.png | Bin 2759 -> 988 bytes .../components/Compas_FromJson/metadata.json | 1 + .../components/Compas_Info/icon.png | Bin 2759 -> 1287 bytes .../components/Compas_Info/metadata.json | 1 + .../components/Compas_ToJson/icon.png | Bin 2759 -> 979 bytes .../components/Compas_ToJson/metadata.json | 1 + .../components/Compas_ToRhinoGeometry/code.py | 14 ++++++++++ .../Compas_ToRhinoGeometry/icon.png | Bin 0 -> 1159 bytes .../Compas_ToRhinoGeometry/metadata.json | 25 ++++++++++++++++++ src/compas_ghpython/components/__init__.py | 11 -------- 15 files changed, 47 insertions(+), 55 deletions(-) delete mode 100644 src/compas_ghpython/components/Compas_Frame/code.py delete mode 100644 src/compas_ghpython/components/Compas_Frame/icon.png delete mode 100644 src/compas_ghpython/components/Compas_Frame/metadata.json create mode 100644 src/compas_ghpython/components/Compas_ToRhinoGeometry/code.py create mode 100644 src/compas_ghpython/components/Compas_ToRhinoGeometry/icon.png create mode 100644 src/compas_ghpython/components/Compas_ToRhinoGeometry/metadata.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd84c4c64e..4c59ed2c3a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added optional `triangulated` flag to `Mesh.to_vertices_and_faces`. +* Added Grasshopper component to draw any COMPAS object. +* Added new icons to Grasshopper components and default to icon style. ### Changed diff --git a/src/compas_ghpython/components/Compas_Frame/code.py b/src/compas_ghpython/components/Compas_Frame/code.py deleted file mode 100644 index 68eb236c194..00000000000 --- a/src/compas_ghpython/components/Compas_Frame/code.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -Draws a frame or plane. -""" -from ghpythonlib.componentbase import executingcomponent as component - -from compas_ghpython.artists import FrameArtist -from compas_ghpython.components import coerce_frame - - -class CompasFrame(component): - def RunScript(self, frame): - plane = None - - if frame: - frame = coerce_frame(frame) - artist = FrameArtist(frame) - - plane = artist.draw() - - return plane diff --git a/src/compas_ghpython/components/Compas_Frame/icon.png b/src/compas_ghpython/components/Compas_Frame/icon.png deleted file mode 100644 index c8df236e3a30d99b26c306af3495da68e531e6e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2759 zcmcgudsGu=77ubjprv&IvC67ruz-)rJo11HL4;BCF^%yq$8 zJf7omT9s%_RK{QgqZQyJqoxFAt)4^kctOEtJx-)kMnFxa(mEOc{>e^0K$9|lf>;SF z^21wMkA)d1+{hSI43ja{sJJQ00Lo)HS^o$85$BmSXZ|xfhBOnT^ z5EK&&F(JAHMlcwjfGQc1)>v#%#0rH2REP)@`Tq*XDTc(2_=}MwfoT|n7Uz2;}mz*a&mjLBdOTu6?W@Y#7qSXi8a(a;&(0=p_A6i|eRNf4<-0-^$BoTyTXDRit6 z*AbLLF5`2B5zsV=`Afwbv04-W3dNKZL{O0sl!^#7h!7Hz#3?l)3LvKJRvKt-GvXP~dbP45 zIgf}?qMN`72LSR~DI{k2SPqSe&q$x#Lk zj0*?D3G0TC@d>LED3U)pO+Tj|FBN&x-jqghPG6vpiRdh&F`94#6_U!;?j;lm{T6)| z&w4R=T#S=yoIpWTf{H<$;@YYfNk~u=pus6bEYYYX(y8QajYAXQ&g0p)E94=n$nIln>6N>aJS6c1>1Nj(e`z$NyLfX+`g*tS&5y6o zPeFx+Cw94gA5$CezW;(BRr7_@On((RP`uyalEU#HT^BuPWF9zr`eJP!uoHCXxX^v; z^Qa%drdnrT>0h_pmpux4^x=alHqhmZ`ah~}r)mlXwYim_%$;>8j@h-gzEl}|VZHm} zGlhu}yGZnE0npHm$j!pgJ#V#uDs? z-tS!cmxfI-VEg`#%g&{p^X+erOpogylxrxV=MQ(hES2AV<+%M^Psw0mqkXt*n#ocS zoAX)j?>}eqD@>NLFMs-GBb0k9=#k&|h4wI#RGqo@+pTeyYd1nKeTo(bC+zgS*Sz5F zqR$qwbz=*cXB_s)tvP6SL;kcY|I?(Iqk@xeg`N?KUTyx8r0N;Yz@`-)-$9xD;^GnlpgT75&yDWV(D?V)2*0rR~&P$m_yaBmoKZy4l zEpeE2@FTRdV2JI%lwb0bIHbs{`O5X|4TnUYdC_|u%MO2it7<4Dc?ZfnqjPUCw>LKh zR-6c)m)Ocb?^M)X#C>FhiU2Wr*{yC~OU{85 z_k2o&fmfnyT58T7!FxBjFRhlD|Eb^K)NkM4zii$|zw>>PQ>ZHqdjA(=+ry}1Nshol zHYcPyP(*{V{)0#xr06}h*nMy;N$_U&>vqW_W~9b>R^G>5>Z9j)K6Pos&hTl&t$W#3 zOD#Sn;TKI~zc>YNY;nDkANk|T_9yeFwaPs57GQ1s^C=HrbBU+F^=j-~=lT@rIFKL; z3n_FhU$eK^kF1@(aE3r0Gwk`W{ATyP`@5^;zOQ=4?pe2BP(HkE=QMY02)q)zHwn4@ zPScFQ2g1N3V;lXHo%_mE$A!^P*Q4uVG{w@@p`Npc!g957v)|ghrSET1e^2?b&#jeF z6Su%lRQGkMqiEvyxscVQr&GqR-9k9&-+P> cdf~`i)t_^mjx6cBXZ_SvgvZL8LsJU=4QD(61^@s6 diff --git a/src/compas_ghpython/components/Compas_Frame/metadata.json b/src/compas_ghpython/components/Compas_Frame/metadata.json deleted file mode 100644 index 6520be9ccca..00000000000 --- a/src/compas_ghpython/components/Compas_Frame/metadata.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "Frame", - "nickname": "Frame", - "category": "COMPAS", - "subcategory": "Display", - "description": "Draws a frame or plane", - "exposure": 2, - - "ghpython": { - "isAdvancedMode": true, - "inputParameters": [ - { - "name": "frame", - "description": "The frame or plane to be drawn." - } - ], - "outputParameters": [ - { - "name": "plane", - "description": "The drawn plane." - } - ] - } -} \ No newline at end of file diff --git a/src/compas_ghpython/components/Compas_FromJson/code.py b/src/compas_ghpython/components/Compas_FromJson/code.py index 6bcb01f7f3b..808d2290ad0 100644 --- a/src/compas_ghpython/components/Compas_FromJson/code.py +++ b/src/compas_ghpython/components/Compas_FromJson/code.py @@ -8,6 +8,9 @@ class CompasInfo(component): def RunScript(self, json): + if not json: + return None + try: return compas.json_load(json) except: # noqa: E722 diff --git a/src/compas_ghpython/components/Compas_FromJson/icon.png b/src/compas_ghpython/components/Compas_FromJson/icon.png index c8df236e3a30d99b26c306af3495da68e531e6e3..83db429984214337466a9c64dd5be8e8ec75eb0e 100644 GIT binary patch delta 959 zcmV;w13>)872F4qD}M_T000XT0n*)m`~Uz0j!8s8R7i=nR$oY4R~Y}@iiqJ zEp$VZl@chGBG!jK*$%hjq*D5__Q4{35k!Q7?L%QJQcLwgS)m9%3;q=U3b(a~YrtO5l` zB*^3OI46okB7bK1WFHzDvdszMaG3ig5(!jSR~HDlD2&|#OY16(Ky}dR8 z8n?H%qphvYoQvZr$boRA&__o{ZRGTgqMDqXED)ZUn85h>xYH5w97xvP6Hzc2}QhzC|tgLWbU0ofo7|H|9>+9>` z_xmw2GU8Z8Fm~@IZi1pH|GMU#zO}Tp5VsdV&L-egvhUH#0iHpL01nN}%(QQ$l_#kkHBZjEu9K77cF~Uh zP=pGvAAf(ITi+`V$=IQ6h!hhxwv^vK@OwiURY&ys4x-5nlpMbg%<-qf+T5}$?JqCx zvyh7jiU$V=Yqzs%oXDphzrxkorx=}oiTHXJUxrILi)^#&zh^gJ(-CO6CC^ z2T-)0&ivska(k{nNFeqi10}DS$Z2mW3x4dVeRcmZ&xL^3>%ooj)A;e*M<3t+KK9`2 zO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@xeg`N?KUTyx8r0N;Yz@`-)-$9xD;^GnlpgT75&yDWV(D?V)2*0rR~&P$m_yaBmoKZy4l zEpeE2@FTRdV2JI%lwb0bIHbs{`O5X|4TnUYdC_|u%MO2it7<4Dc?ZfnqjPUCw>LKh zR-6c)m)Ocb?^M)X#C>FhiU2Wr*{yC~OU{85 z_k2o&fmfnyT58T7!FxBjFRhlD|Eb^K)NkM4zii$|zw>>PQ>ZHqdjA(=+ry}1Nshol zHYcPyP(*{V{)0#xr06}h*nMy;N$_U&>vqW_W~9b>R^G>5>Z9j)K6Pos&hTl&t$W#3 zOD#Sn;TKI~zc>YNY;nDkANk|T_9yeFwaPs57GQ1s^C=HrbBU+F^=j-~=lT@rIFKL; z3n_FhU$eK^kF1@(aE3r0Gwk`W{ATyP`@5^;zOQ=4?pe2BP(HkE=QMY02)q)zHwn4@ zPScFQ2g1N3V;lXHo%_mE$A!^P*Q4uVG{w@@p`Npc!g957v)|ghrSET1e^2?b&#jeF z6Su%lRQGkMqiEvyxscVQr&GqR-9k9&-+P> cdf~`i)t_^mjx6cBXZ_SvgvZL8LsJU=4QD(61^@s6 diff --git a/src/compas_ghpython/components/Compas_FromJson/metadata.json b/src/compas_ghpython/components/Compas_FromJson/metadata.json index 1932da19c6b..053b84d4710 100644 --- a/src/compas_ghpython/components/Compas_FromJson/metadata.json +++ b/src/compas_ghpython/components/Compas_FromJson/metadata.json @@ -8,6 +8,7 @@ "ghpython": { "isAdvancedMode": true, + "iconDisplay": 2, "inputParameters": [ { "name": "json", diff --git a/src/compas_ghpython/components/Compas_Info/icon.png b/src/compas_ghpython/components/Compas_Info/icon.png index c8df236e3a30d99b26c306af3495da68e531e6e3..b447b5ee1192e2c39db0d22b445204832be25497 100644 GIT binary patch delta 1260 zcmVT z#T;mQEhv)%rdJK5rvD(@B-;k*}58!xm+gM1M4vThUmN535PURy01dugK;GkN}Vbkm9?_h=#PV)ejC19*U)u0Fhsr z3gMj}0vH-w!`wy^?G44~Xeeef>BvStj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;zOQ=4?pe2BP(HkE=QMY02)q)zHwn4@ zPScFQ2g1N3V;lXHo%_mE$A!^P*Q4uVG{w@@p`Npc!g957v)|ghrSET1e^2?b&#jeF z6Su%lRQGkMqiEvyxscVQr&GqR-9k9&-+P> cdf~`i)t_^mjx6cBXZ_SvgvZL8LsJU=4QD(61^@s6 diff --git a/src/compas_ghpython/components/Compas_Info/metadata.json b/src/compas_ghpython/components/Compas_Info/metadata.json index 61b0b3ebe89..d5c3a05f196 100644 --- a/src/compas_ghpython/components/Compas_Info/metadata.json +++ b/src/compas_ghpython/components/Compas_Info/metadata.json @@ -8,6 +8,7 @@ "ghpython": { "isAdvancedMode": true, + "iconDisplay": 2, "inputParameters": [ ], "outputParameters": [ diff --git a/src/compas_ghpython/components/Compas_ToJson/icon.png b/src/compas_ghpython/components/Compas_ToJson/icon.png index c8df236e3a30d99b26c306af3495da68e531e6e3..ae685b735844f7df0e72bf9c6af1399ae465cf2d 100644 GIT binary patch delta 950 zcmV;n14;bH71IZhD}M_T000XT0n*)m`~Uz0g-Jv~R7i=nRbNO`Q5gT7?QUkfndZMV z7KP3ysjxDQpdLmbg$UA9^IbZK^xD^%wT9}2rVrwx-U~e+KAli^$Mcu>S{fF^7r@m z8^(mHsw%N>aer|U#l^*2N1$zLZEZE2iqO%~fzHlOg8=oLo14+p)TEC$70@%ol66IlF=i0Zi0pQ|7<)V(15s~puVEdvb8~aTS6W)S^&6y< zxm+$ZHa5cV_hWv3Uid02D@Df8JJ7hMrUtSsV_;w)D}RgV^rF#np9(D$3jJ};Z#37? z&_I;A0HOwgtbF}DD*)in`W7+9P9a%rlbQT#*jjQB%<45uYTvB-nTjR7cvPW7Rv<#4 ze#V@(iAXH!732XZ1W@L7yPH>op%4CbCB{{w_30nGd>L@n16CTp23(A>1DtbTdJyUf zB~>Jcuzwl|J@x$FH;Tz&clgKxgWyAr{fs=VYTie!h0T~mNtcV(DtW`L?AYy#STAR#ea z_s4k;V@$hat9tU>U_|jU#w<5qF5$B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bz=*cXB_s)tvP6SL;kcY|I?(Iqk@xeg`N?KUTyx8r0N;Yz@`-)-$9xD;^GnlpgT75&yDWV(D?V)2*0rR~&P$m_yaBmoKZy4l zEpeE2@FTRdV2JI%lwb0bIHbs{`O5X|4TnUYdC_|u%MO2it7<4Dc?ZfnqjPUCw>LKh zR-6c)m)Ocb?^M)X#C>FhiU2Wr*{yC~OU{85 z_k2o&fmfnyT58T7!FxBjFRhlD|Eb^K)NkM4zii$|zw>>PQ>ZHqdjA(=+ry}1Nshol zHYcPyP(*{V{)0#xr06}h*nMy;N$_U&>vqW_W~9b>R^G>5>Z9j)K6Pos&hTl&t$W#3 zOD#Sn;TKI~zc>YNY;nDkANk|T_9yeFwaPs57GQ1s^C=HrbBU+F^=j-~=lT@rIFKL; z3n_FhU$eK^kF1@(aE3r0Gwk`W{ATyP`@5^;zOQ=4?pe2BP(HkE=QMY02)q)zHwn4@ zPScFQ2g1N3V;lXHo%_mE$A!^P*Q4uVG{w@@p`Npc!g957v)|ghrSET1e^2?b&#jeF z6Su%lRQGkMqiEvyxscVQr&GqR-9k9&-+P> cdf~`i)t_^mjx6cBXZ_SvgvZL8LsJU=4QD(61^@s6 diff --git a/src/compas_ghpython/components/Compas_ToJson/metadata.json b/src/compas_ghpython/components/Compas_ToJson/metadata.json index 423dc4ab33a..a19d5d9ab84 100644 --- a/src/compas_ghpython/components/Compas_ToJson/metadata.json +++ b/src/compas_ghpython/components/Compas_ToJson/metadata.json @@ -8,6 +8,7 @@ "ghpython": { "isAdvancedMode": true, + "iconDisplay": 2, "inputParameters": [ { "name": "data", diff --git a/src/compas_ghpython/components/Compas_ToRhinoGeometry/code.py b/src/compas_ghpython/components/Compas_ToRhinoGeometry/code.py new file mode 100644 index 00000000000..f152ef89648 --- /dev/null +++ b/src/compas_ghpython/components/Compas_ToRhinoGeometry/code.py @@ -0,0 +1,14 @@ +""" +Draws COMPAS geometry in Grasshopper. +""" +from ghpythonlib.componentbase import executingcomponent as component + +from compas.artists import Artist + + +class CompasToRhinoGeometry(component): + def RunScript(self, cg): + if not cg: + return None + + return Artist(cg).draw() diff --git a/src/compas_ghpython/components/Compas_ToRhinoGeometry/icon.png b/src/compas_ghpython/components/Compas_ToRhinoGeometry/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..88b3fdd3268eca63e535cf2388754609a3ed41c8 GIT binary patch literal 1159 zcmV;21bF+2P)nlxSt?L##x15Fc3pwN;IbvnRw z2IyRm*=P2i9+|1}#g(k=v(GvE|JVN4T6=4Ng{;}6TQ|A*CoRW}d=_I;j>bD(*E19_ znCF-ed0ZB&&0n*nfwvBQLbGo>vFIwZGXd^z+sRUJp1>bx znGF2S=;#REZ7)KWz;4Q6Ldunw1F;K7CY_>V@5g-i{m-ngenccZN5@0mbnJi@Upt52 z9pKth5>H(Z4)+$dUYG0Dm}iQ>_*h!iZn&`E{8{v>cE)}kEIrrW~l9B86yW!YOTP3^{z+2m%_tTZh&p~*;O;}(p z16%JFq|H>vc*+|MX%v|-Mfj;&-~yW)&gpPs)mZqB#1R-4P1ABa(RDqpKBSZ+Tbp+0 z*u}FVGJ}ipM9_FO0(>i*)ouz{B|L7CZU2wjHJjRj8QkiI*XoSdJwUGncglt>l3uJN zO34~#Y~(p3>dFFnFoTQni3+e6!?78TiirJw|3dff#|Eu-N0Y~CRk_t{vc(0#;j7al z2W~9<;#-S`+-Mrr^_@A%49$bt$OX6{*(XSfU?{-*p->2?%SmAAHh~)(Y$P+hzN^~M z$}JB%x9V!S<(RjTTg6iNF@s1{jS)GRQOf%jxW$B)f0EF$0UgCDME!Mpm039ly&pthP~0iG+< zw5e3p`EI@^EE#Aqb^KRi;ZT6#saO{L!IzFu+kKGrWVTik={r5AlA$_M-CW562bd~D zr{C|N7n=9=_0jwG2Q0Tf$yy?n18pd?Grkbz(MFHa42H{yH@nRQEXu9|sJnSwaeUjN;p#&o1c#SM8wSbtkSt^=LY8G|g&n`f)bG>6sP7 z`@3p6^7y@cIT50>zJxC(LR^m;H)-y|FKB{Px@tt@j;<`S+x*kZMB^#LhsG9pZGM|VwwJuPJnk1z6cTNN)noV_zNssI0D Zz~6X%v8i7^>;?b;002ovPDHLkV1jLkGR^=1 literal 0 HcmV?d00001 diff --git a/src/compas_ghpython/components/Compas_ToRhinoGeometry/metadata.json b/src/compas_ghpython/components/Compas_ToRhinoGeometry/metadata.json new file mode 100644 index 00000000000..8329fa38ac9 --- /dev/null +++ b/src/compas_ghpython/components/Compas_ToRhinoGeometry/metadata.json @@ -0,0 +1,25 @@ +{ + "name": "Draw", + "nickname": "Draw", + "category": "COMPAS", + "subcategory": "Display", + "description": "Draws COMPAS geometry", + "exposure": 2, + + "ghpython": { + "isAdvancedMode": true, + "iconDisplay": 2, + "inputParameters": [ + { + "name": "cg", + "description": "The COMPAS geometry or datastructure to be drawn." + } + ], + "outputParameters": [ + { + "name": "rg", + "description": "The Rhino geometry object." + } + ] + } +} diff --git a/src/compas_ghpython/components/__init__.py b/src/compas_ghpython/components/__init__.py index a3c499fb19c..c013ea16ec6 100644 --- a/src/compas_ghpython/components/__init__.py +++ b/src/compas_ghpython/components/__init__.py @@ -34,17 +34,6 @@ import compas_rhino -def coerce_frame(plane): - import Rhino - from compas.geometry import Frame - if isinstance(plane, Rhino.Geometry.Plane): - return Frame(plane.Origin, plane.XAxis, plane.YAxis) - elif isinstance(plane, Frame): - return plane - else: - return Frame(*plane) - - def get_version_from_args(): parser = argparse.ArgumentParser() parser.add_argument('-v', '--version', choices=compas_rhino.SUPPORTED_VERSIONS, default=compas_rhino.DEFAULT_VERSION) From 36c72b080b69c30297649644d7e0dcc93f13a4ac Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Mon, 28 Mar 2022 09:29:07 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f2ec7010e..fdbeccf631a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added geometry information of active meshes to the serialization/deserialization of robot model's `MeshDescriptor`. * Added Grasshopper component to draw any COMPAS object. * Added new icons to Grasshopper components and default to icon style. -======= ### Changed