Is there a built in C# function to subtract solids from beams? I have been using the following code which works but it adds the solid to subtract to the doc before subtracting and I was wondering if that could be suppressed?
Could you explain more how the AddElementModifier works? I haven’t been able to get it to work. What I am trying to do is I have a beam and I want to subtract a sold circular or rectangular solid from the beam. Here is the code I am using
bool test = va.AddElementModifier(sourceObj.Id, hole_intersection_guid, va.ElementModifierOperation.Subtract);
Enric,
I played around with the Element Modifier methods a little and I think this is a bug. If I create a beam with some holes and extract the modifiers with va.ExtractElementModifiers() the list of “Guid element_modifiers” gets populated but with empty Guids’ (00000000-0000-0000-0000-000000000000). Here is the code that I tested it with. Try it and let me know, thanks
using System;
using Rhino;
using Rhino.Collections;
using Rhino.Commands;
using Rhino.DocObjects;
using Rhino.Input;
using Rhino.Input.Custom;
using Rhino.Geometry;
using Rhino.Geometry.Collections;
using System.Collections.Generic;
using VA = VisualARQ.Script;
var doc = RhinoDoc.ActiveDoc;
GetObject get_source_obj;
get_source_obj = new GetObject();
get_source_obj.SetCommandPrompt(“Select objects to subtract from”);
get_source_obj.GeometryFilter = ObjectType.InstanceReference;
get_source_obj.GetMultiple(1, 1);
ObjRef source_obj = get_source_obj.Object(0);
/*
GetObject get_cutting_obj;
get_cutting_obj = new GetObject();
get_cutting_obj.SetCommandPrompt(“Select objects to make hole”);
get_cutting_obj.GeometryFilter = ObjectType.Brep;
get_cutting_obj.GetMultiple(1, 1);
ObjRef cut_obj = get_cutting_obj.Object(0);
Enric,
Did you try this out because I haven’t been able to get the VA.AddElementModifier to work and was wondering if it was something that I was doing? Thanks
I’ve been able to reproduce the issue. I’ve already fixed it for the next VisualARQ 3 Beta. Do you need this change in VisualARQ 2? I can make a build of VisualARQ 2.13.3 for you with this change.
Thanks for getting back with me, I thought that you guys were busy working on it and I appreciate all your work. If you could send me a link with the build I would like to give it a try because it would make my scripts work a lot better and I’d love to give it a try and update my scripts. Thanks