MaskOfSanity
Member
Hello,
i am currently developing a just for fun External Forms Application to do some Stuff with Alibre Design via API.
(creating default Shapes for L, T, S, U-Profile, Involute Gears and with the new Release i tried a CAM based on 3D-Sketches)
This works really nice if you do it from the application side. For improvement of UX i thought it would be easy to use Alibre Design direct to Pick Items but this doesn't work like expected.
Has anyone some advice, hints or tips?
More detailed explanation:
I used the Example from "SelectionAddOnSample" and transfered it to C#. Only for the first 2 cases, Vertices and Edges.
Then i do a auto selection of some edges.
After that i used
As Result i get:
What can i do to readback selected Elements?
Selection of testCollector works, but i can't do anything with the Data inside IObjectCollector.
Need Help.
Greetings.
i am currently developing a just for fun External Forms Application to do some Stuff with Alibre Design via API.
(creating default Shapes for L, T, S, U-Profile, Involute Gears and with the new Release i tried a CAM based on 3D-Sketches)
This works really nice if you do it from the application side. For improvement of UX i thought it would be easy to use Alibre Design direct to Pick Items but this doesn't work like expected.
Has anyone some advice, hints or tips?
More detailed explanation:
I used the Example from "SelectionAddOnSample" and transfered it to C#. Only for the first 2 cases, Vertices and Edges.
Then i do a auto selection of some edges.
After that i used
C#:
void exampleMethod()
{
SelectionHelper selectionHelper = new SelectionHelper(); // This is the example implementation from SelectionAddOnSample --> CSelectObjectCommand::OnSelect(...)
selectionHelper.OnSelect(session, 1);
IObjectCollector collector = session.SelectedObjects; // From the active part session get the selected objects (i think this could be a picker)
if (collector != null)
{
logbuch.print("Currently Selected Objects = " + collector.Count.ToString());
logbuch.print("Object Type? ==> " + collector.ObjectType.ToString());
for (int i = 0; i < collector.Count; i++)
{
string typeName = "Unknown";
object test = null;
try
{
IObjectCollector testCollector = session.Root.NewObjectCollector(); // Additional Collector to get the First Edge Element of the whole selection
if (i == 0)
{
testCollector.Add(collector.Item(i));
session.Select(testCollector);
}
test = collector.Item(i) as IADEdge;
if (collector.Item(i) is IADEdge edge)
{
typeName = "IADEdge";
}
}
catch (Exception ex)
{
logbuch.print("Error: " + ex.Message);
}
logbuch.print("Selected Object (" + i.ToString() + "): " + (collector.ObjectType.ToString()) + ", of Type: " + typeName);
}
}
}
As Result i get:
What can i do to readback selected Elements?
Selection of testCollector works, but i can't do anything with the Data inside IObjectCollector.
Need Help.
Greetings.