Skip to content

Commit 5077730

Browse files
author
moethu
committed
added curves to GH component
1 parent 2cb509e commit 5077730

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

SketchUpForGrasshopper/SketchUp.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager
5454
pManager.AddBrepParameter("Surfaces", "S", "Surfaces", GH_ParamAccess.list);
5555
pManager.AddTextParameter("Layers", "L", "Layers", GH_ParamAccess.list);
5656
pManager.AddGenericParameter("Instances", "I", "Instances", GH_ParamAccess.list);
57+
pManager.AddCurveParameter("Curves", "C", "Curves", GH_ParamAccess.list);
5758
}
5859

5960
protected override void SolveInstance(IGH_DataAccess DA)
@@ -64,10 +65,11 @@ protected override void SolveInstance(IGH_DataAccess DA)
6465
List<GH_Brep> surfaces = new List<GH_Brep>();
6566
List<GH_String> layers = new List<GH_String>();
6667
List<Instance> Instances = new List<Instance>();
68+
List<GH_Curve> curves = new List<GH_Curve>();
6769

6870
SketchUp skp = new SketchUp();
6971
if (skp.LoadModel(path.Value))
70-
{
72+
{
7173
foreach (Surface srf in skp.Surfaces)
7274
foreach (var brep in srf.ToRhinoGeo())
7375
surfaces.Add(new GH_Brep(brep));
@@ -77,11 +79,15 @@ protected override void SolveInstance(IGH_DataAccess DA)
7779

7880
foreach (Instance i in skp.Instances)
7981
Instances.Add(i);
82+
83+
foreach (Edge c in skp.Edges)
84+
curves.Add(new GH_Curve(c.ToRhinoGeo().ToNurbsCurve()));
8085
}
8186

8287
DA.SetDataList(0, surfaces);
8388
DA.SetDataList(1, layers);
8489
DA.SetDataList(2, Instances);
90+
DA.SetDataList(3, curves);
8591
}
8692

8793
public override Guid ComponentGuid
@@ -180,7 +186,7 @@ public static class Geometry
180186
/// <summary>
181187
/// Converts a SketchUp Vertex to a Rhino Point
182188
/// </summary>
183-
public static Rhino.Geometry.Point3d ToRhinoGeo(this SketchUpNET.Vertex v, Transform t)
189+
public static Rhino.Geometry.Point3d ToRhinoGeo(this SketchUpNET.Vertex v, Transform t = null)
184190
{
185191
if (t == null)
186192
return new Rhino.Geometry.Point3d(v.X , v.Y , v.Z );
@@ -202,7 +208,7 @@ public static Rhino.Geometry.Vector3d ToRhinoGeo(this SketchUpNET.Vector v)
202208
/// <summary>
203209
/// Converts a SketchUp Edge to a Rhino Line
204210
/// </summary>
205-
public static Rhino.Geometry.Line ToRhinoGeo(this SketchUpNET.Edge v, Transform t)
211+
public static Rhino.Geometry.Line ToRhinoGeo(this SketchUpNET.Edge v, Transform t = null)
206212
{
207213
return new Rhino.Geometry.Line(v.Start.ToRhinoGeo(t), v.End.ToRhinoGeo(t));
208214
}

Testfiles/TestDefinition.gh

809 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)