Grasshopper

algorithmic modeling for Rhino

Hi everyone!

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

The attachment file works just with circles!

Views: 2298

Attachments:

Replies to This Discussion

change the input type from OnCircle to OnCurve
Thanks! I tried it but it's not working . The VB component getting to red.
Attachments:
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:
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.
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:

I have used the nurbs curve tool to create a number of curves.

I want to export each curve seperately to an iges file.

I tried using your code above but it doesn't work. More specifically it creates the files with the correct file names but all the files contain the last curve from the ones mentioned above.

Any ideas?

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
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 !
Hello Rajaa Issa,

many thanks!
I tested your script but without success! Eventually I do something wrong whit integrating in the VB tool.
Rafi,
Please post your definitiona and sample file.
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:
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:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service