Grasshopper

algorithmic modeling for Rhino


I have two components - one is a curve primitive, the other is a curve that is offset from another curve.


If the primitive has a curve assigned, I want to use it. If not, I want to use the offset.


Is there a single component that I can use to choose between these two items, connecting just it to subsequent components?

Views: 615

Replies to This Discussion

please upload a gh file for a better undestanding

In the attached gh file:

I've used the "Pick n Choose" component to represent the component that I want.

if curve_2 has a curve assigned (value is not empty), the component should use that curve to extrude. 

If there is no curve_2 assigned, should use the offset from curve_1.

Attachments:

no internalized data found for the curves

I've added internalized data so that you can see two curves - but I don't think it explains my problem any better.

If curve_2 is not defined, I want to use the offset of curve_1 as a backup.

Attachments:

you can try the Evaluate or Expression component

Thanks again!


I'm having a little trouble implementing your suggestion though. The component throws the following error when the input is Null:

"1. Expression generated an error for (a, b): Left hand value of operator = is Null"


Also, is there a way of checking for all "falsy" values - Null, empty, etc

one example with some lines/curves could help. If you have some objects for curve_1 and curve_2 please internalize the objects and upload your file

I've internalized a curve for a.  For b, there is no curve, which is basically the idea.

Rather than returning the curve, both components simple return a "True" value.

When the curve that is used in the "if" clause is Null (undefined), the component throws an exception. Which obviously is not the right behavior.

Attachments:

try this component

Attachments:

Thanks Raul, that does the job.


I've attached a python version.

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