Grasshopper

generative modeling for Rhino

Hi everyone!

I having a problem saving NURBS curves to separated Iges files.

The attachment file works just with circles!

Tags: iges, save

Attachments:

Reply to This

Replies to This Discussion

change the input type from OnCircle to OnCurve

Reply to This

Thanks! I tried it but it's not working . The VB component getting to red.
Attachments:

Reply to This

hi rafi

attached the rewritten ghx
you had to build a list of curves inside your vb to get them all exported

Dim crv As Oncurve
Dim mCurveObj As New List (Of MRhinoCurveObject)
'bake each curve
For Each crv In arrcrv
mCurveObj.Add(doc.AddCurveObject(crv))
doc.UnselectAll
Next

best to]
Attachments:

Reply to This

Thanks a lot!

I'm sorry that I just now writing back.

I tried your definition but it's still not what I'm actually need.
I want a VB script what's creating from each curve a separated file.
I will have some thousand curves in my definition what must be separated.

I'm hoping on help.

Reply to This

Hi Rafi!

you must insert the for loop:
for i=0 to arrcrv.count-1
filename= filename&i
next

instead of: for each crv in arrcrv

now you will get a single file for each curve


'////// Marc Hoppermann ///////////tweaked by Damien Almor ///////rewritten for curves by to]///////adapted by u]
If blnSave Then

For i As Int32 = 0 To arrcrv.Count - 1
MRhinoView.EnableDrawing(False)
'Dim crv As Oncurve
Dim mCurveObj As New List (Of MRhinoCurveObject)

'bake the curve
mCurveObj.Add(doc.AddCurveObject(arrcrv(i)))
doc.UnselectAll

'export curve in a file
app.RunScript("SelAll", 0)
app.RunScript("_-export " & sFileName & i & FileType & " _Enter", 0)
app.RunScript("_delete", 0)
MRhinoView.EnableDrawing(True)

MRhinoView.EnableDrawing(True)
print("exported to " & sFileName & i & FileType)
Next
Else print("inactive")

End If
Attachments:

Reply to This

Hi Rafi,

Try the following.
Let me know if this works for you.



Private Sub RunScript(ByVal Crv As OnCurve, ByVal sFileName As String, ByVal blnSave As Boolean, ByRef A As Object)
'////// Marc Hoppermann ///////////

If blnSave Then

Dim nc As New OnNurbsCurve
nc = Crv.NurbsCurve()

Dim mObj As New MRhinoCurveObject
mObj = doc.AddCurveObject(nc)

doc.UnselectAll
mObj.Select()

app.RunScript("_-export " & sFileName & " _Enter")
app.RunScript("_delete")
End If

End Sub

Reply to This

Hello °[u ,
I'm sorry I was that Busy

but finally I tested your script. It seems to work, if I just take a look on the Rhino command Line. But afterward in the saving folder was just one file exported and inside was the whole group of curves. In the Original File was annulated the base curves in the Model space.

Properly just a little missing code !

Reply to This

Hello Rajaa Issa,

many thanks!
I tested your script but without success! Eventually I do something wrong whit integrating in the VB tool.

Reply to This

Rafi,
Please post your definitiona and sample file.

Reply to This

Hi Rajaa Issa,

The File it's just a example and I think something of my mistake it's a tree question if you take a look on the numbering system.
Attachments:

Reply to This

Hi Rafi,

Idon't think you have the code I suggested in your example. I'll try to work with your code, but for now, here is the file I used to save NURBS curves.
Attachments:

Reply to This

Thanks Rajaa Issa

Supper now it's working!!!

Reply to This

RSS

© 2010   Created by Scott Davidson.   Powered by .

Badges  |  Report an Issue  |  Terms of Service