@@ -72,7 +72,7 @@ public static Dictionary<string, object> LoadModel(string path, bool includeMesh
7272 foreach ( Edge e in skp . Edges )
7373 edges . Add ( e . ToDSGeo ( ) ) ;
7474
75- foreach ( Group gr in grp )
75+ foreach ( Group gr in skp . Groups )
7676 grp . Add ( gr ) ;
7777
7878 }
@@ -93,7 +93,7 @@ public static Dictionary<string, object> LoadModel(string path, bool includeMesh
9393 /// SketchUp Component Instance Data
9494 /// </summary>
9595 /// <param name="instance">SketchUp Component Instance</param>
96- [ MultiReturn ( new [ ] { "Surfaces" , "Curves" , "Instances" , "Meshes" , "Edges" , "Position" , "Scale" , "Name" , "Parent Name" } ) ]
96+ [ MultiReturn ( new [ ] { "Surfaces" , "Curves" , "Instances" , "Meshes" , "Edges" , "Position" , "Scale" , "Name" , "Parent Name" , "Groups" } ) ]
9797 public static Dictionary < string , object > GetInstance ( Instance instance )
9898 {
9999 List < Autodesk . DesignScript . Geometry . Surface > surfaces = new List < Autodesk . DesignScript . Geometry . Surface > ( ) ;
@@ -116,6 +116,11 @@ public static Dictionary<string, object> GetInstance(Instance instance)
116116 foreach ( Edge e in parent . Edges )
117117 edges . Add ( e . ToDSGeo ( instance . Transformation ) ) ;
118118
119+ foreach ( Group grp in parent . Groups )
120+ {
121+ grp . Transformation = instance . Transformation ;
122+ }
123+
119124 return new Dictionary < string , object >
120125 {
121126 { "Surfaces" , surfaces } ,
@@ -126,36 +131,36 @@ public static Dictionary<string, object> GetInstance(Instance instance)
126131 { "Position" , p } ,
127132 { "Scale" , instance . Transformation . Scale } ,
128133 { "Name" , instance . Name } ,
129- { "Parent Name" , parent . Name }
134+ { "Parent Name" , parent . Name } ,
135+ { "Groups" , parent . Groups }
130136
131137 } ;
132138 }
133139
134140 /// <summary>
135141 /// SketchUp Component Instance Data
136142 /// </summary>
137- /// <param name="instance ">SketchUp Component Instance</param>
138- [ MultiReturn ( new [ ] { "Surfaces" , "Curves" , "Instances" , "Meshes" , "Edges" , "Name" } ) ]
139- public static Dictionary < string , object > GetGroup ( Group instance )
143+ /// <param name="group ">SketchUp Component Instance</param>
144+ [ MultiReturn ( new [ ] { "Surfaces" , "Curves" , "Instances" , "Meshes" , "Edges" , "Name" , "Groups" } ) ]
145+ public static Dictionary < string , object > GetGroup ( Group group )
140146 {
141147 List < Autodesk . DesignScript . Geometry . Surface > surfaces = new List < Autodesk . DesignScript . Geometry . Surface > ( ) ;
142148 List < List < Autodesk . DesignScript . Geometry . Line > > curves = new List < List < Autodesk . DesignScript . Geometry . Line > > ( ) ;
143149 List < Autodesk . DesignScript . Geometry . Line > edges = new List < Autodesk . DesignScript . Geometry . Line > ( ) ;
144150 List < Autodesk . DesignScript . Geometry . Mesh > meshes = new List < Autodesk . DesignScript . Geometry . Mesh > ( ) ;
145151 List < Instance > insts = new List < Instance > ( ) ;
146152
147-
148- foreach ( Surface srf in instance . Surfaces )
153+ foreach ( Surface srf in group . Surfaces )
149154 {
150- surfaces . Add ( srf . ToDSGeo ( ) ) ;
155+ surfaces . Add ( srf . ToDSGeo ( group . Transformation ) ) ;
151156 if ( srf . FaceMesh != null )
152- meshes . Add ( srf . FaceMesh . ToDSGeo ( ) ) ;
157+ meshes . Add ( srf . FaceMesh . ToDSGeo ( group . Transformation ) ) ;
153158 }
154- foreach ( Curve c in instance . Curves )
155- curves . Add ( c . ToDSGeo ( ) ) ;
156- foreach ( Edge e in instance . Edges )
157- edges . Add ( e . ToDSGeo ( ) ) ;
158- foreach ( Instance e in instance . Instances )
159+ foreach ( Curve c in group . Curves )
160+ curves . Add ( c . ToDSGeo ( group . Transformation ) ) ;
161+ foreach ( Edge e in group . Edges )
162+ edges . Add ( e . ToDSGeo ( group . Transformation ) ) ;
163+ foreach ( Instance e in group . Instances )
159164 insts . Add ( e ) ;
160165
161166 return new Dictionary < string , object >
@@ -165,8 +170,8 @@ public static Dictionary<string, object> GetGroup(Group instance)
165170 { "Instances" , insts } ,
166171 { "Meshes" , meshes } ,
167172 { "Edges" , edges } ,
168- { "Name" , instance . Name } ,
169-
173+ { "Name" , group . Name } ,
174+ { "Groups" , group . Groups } ,
170175 } ;
171176 }
172177
0 commit comments