Hello,
I need some help in using the FindUsingVector() method in C#. According to the help file, there is the optional argument LocationPoints.
The help for VB says it is a Variant.
ComponentDefinition.FindUsingVector( OriginPoint As Point, Direction As UnitVector, ObjectTypes() As SelectionFilterEnum, [UseCylinder] As Boolean, [ProximityTolerance] As Variant, [VisibleObjectsOnly] As Boolean, [LocationPoints] As Variant ) As ObjectsEnumerator
In C# intellisense tells me that out Locationspoints is of type object.
How do I get from this object to the set of points that the method should give as result?
Best regards
Erik
Solved! Go to Solution.
Solved by Maxim-CADman77. Go to Solution.
Solved by adam.nagy. Go to Solution.
Hi Erik,
This blog post discusses optional arguments in C#, e.g. using Type.Missing:
http://modthemachine.typepad.com/my_weblog/2010/08/using-c-with-the-inventor-api-part-3.html
Cheers,
Okay, so I tried casting locationPoints as ObjectsEnumerator. That worked.
I still wonder why you do not use out ObjectsEnumerator like in FindUsingRay directly and one has to cast out object as ObjectsEnumerator.
Thanks!
Nowadays I try to create plugin on C# that uses FindUsingVector method.
Initially I thought I can use only first three arguments but I got "Invalid callee" exception. Forum people hint me that for plugins (unlike add-in) all seven arguments are necessary.
My algorithm needs only intersected entities (no need for LocationPoints) thus I've used "null".
oPCD.FindUsingVector(oPoint, oUnitVector, oSelectionFilterEnums, true, null, true, null)
Compiler detects this as error:
Argument 7: Cannot convert from'<null>' to 'out object'
Should I introduce true ObjectsEnumerator object in this case or there is some better solution?
My post was marked as an answer by mistake. It was a question.....
Ok. That was late night and I've payed no attention Visual Studio has recommendation to fix this.
Final code is:
oPCD.FindUsingVector(oPoint, oUnitVector, oSelectionFilterEnums, true, null, true, out _)