algorithmic modeling for Rhino
Hello,
I've recently started working in C# and I'm realizing what a lazy coder I've been; I've got what is probably a simple problem. I'm attempting to split a Brep with multiple Breps, which is simple in Python:
cnt=0
while cnt<len(inlet_outlet_geometry):
base_geometry = Rhino.Geometry.Brep.Split(base_geometry, inlet_outlet_geometry[cnt], tol)
base_geometry = base_geometry[1]
cnt+=1
In this Python case, there are two surfaces (inlet_outlet_geometry) that are cutting (base_geometry). The loop iterates through each inlet_outlet surface and cuts the base_geometry once. Between cutting, the Open Brep index [1] is selected. Basically I'm cutting windows in a box, iterating one by one.
When I move to C#:
for(int i = 0;i < inlet_outlet_geometry.Count();i++){
base_geometry_out = base_geometry.Split(inlet_outlet_geometry[i], Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
base_geometry = base_geometry[1];
}
I get the error "Cannot apply indexing with [] to an expression of type 'Rhino.Geometry.Brep". Are Brep objects immutable? Can I not overwrite the value of this brep? What am I missing? I have the type hints and parameter access set correctly.
thanks for your help,
Tags:
Thanks for the reply, I did declare the variable as a list access in the input param, so at the private Void RunScript level, I pass these in as Brep<List>. Is that not enough?
Ha, no worries, thanks again for your help. I just learned a lot.
Could you briefly explain the IF statement?
Ok, actually I think I got it. You're saying if the range is greater than 1 (meaning there is a trimmed surface and an open brep), then set the base brep to result index 1 (which is the open brep).
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by