Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I am trying to create brep volume component in VB. I need new component since I want to add additional information from the volume component beside the volume it self.

I created something like that in Gh (see attached pic), but I want to have only one component for the volume information and the message.

So if someone could help me with just recreating the volume component I will be very I thankful.

I am also sending what I have so far in VB, there is a chance that it doesn't have much sense, but it is my first component, all these scripting is new to me.

Regards,

Jelena

 

Views: 565

Attachments:

Replies to This Discussion

So you want a component which takes a brep and a volume threshold, computes and outputs the volume AND outputs whether that volume is less than the threshold? Do you also want the capping to be part of the component?

In the meantime, here's how to just measure the volume straight up:

Protected Overrides Sub SolveInstance(DA As IGH_DataAccess)
Dim shape As Brep = Nothing
If (Not DA.GetData(0, shape)) Then Return
If (shape Is Nothing) Then Return

Dim volume As Double = shape.GetVolume()
DA.SetData(0, volume)
End Sub

Yes David,

Thank you so much. This worked so far.

I know that I have to have one more output for the information whether or not the volume is less than the threshold. I know how to create one more output.

I will try to create the Solve Instance for that part.

I found this part in some of the Gh SDK examples, which is ok only for the first instance. I want error information if there is no brep selected. But I want as output to have the following information:

The volume is too large to be printed at once

or

The volume can be printed


If (volume < Rhino.RhinoMath.ZeroTolerance) Then
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "There is nothing to be printed")
Return
End If

If (volume > Rhino.RhinoMath.ZeroTolerance And volume < 1000) Then
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The volume can be printed")
Return
End If

If (volume > 1000) Then
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The volume is too large to be printed at once")
Return

End If

Attachments:

Wouldn't there also be limits on the physical size of the object? I assume that a specific 3d printer can only accomodate objects smaller than WxDxH cms?

Attached a (completely untested) component which will try to cap open breps, then measure the volume, check it against a limit and sets error messages.

Attachments:

David,

This worked perfectly, thank you so much.

Yes you're right there should be. For now I'm just truing to get to know the VB better, so the numbers are really rough.

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