Creating plane with AddBy3Points - how to obtain Points of type Objects for creating it.

Pioneer
Pioneer

 Hello all,

 

I'm working on VB macro where one of steps is to create plane in assembly lying on three points.

The command AddBy3Points need as input three points of type Object, and I have just three points as Array of Double. 

My first idea was to create 3D sketch with two lines, which endpoints would be the keypoints for the plane creating.  Here, I have issue how to pick their endpoints as the objects - GetKeypointPosition method get just array.

The another idea was somehow convert arrays of double to COM object, but also I have no clue how..

 

 

.. could you help me with this? Smiley Happy

 

Thank you

4 REPLIES

Re: Creating plane with AddBy3Points - how to obtain Points of type Objects for creating it.

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

There are 3 classes in the SE API that contain the AddBy3Points() method. 2 of which are plane related. Which one are you specifically referring to? Also, using the search feature of the forums using keyword ‘AddBy3Points’, I got quite a few hits.

 

This one could possibly be your answer.

http://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/Can-you-Add-a-Plane-by-3-P...

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Creating plane with AddBy3Points - how to obtain Points of type Objects for creating it.

Pioneer
Pioneer

Hi Jason, I'm talking about adding plane in Assembly, so SolidEdgeAssembly.AsmRefPlanes.AddyBy3Points

(Object RootPoint, Object SecondXAxisPoint, Object ThirdPoint)

 

I have just keypoints as Arrays of Double, and don't know how to create the needed Objects from them.

 

This forum is my biggest inspiration, so always when I'm looking for something, I went through the related discussions. However, I didn't notice something what could help me with this

 

Thank you

Lubos

Re: Creating plane with AddBy3Points - how to obtain Points of type Objects for creating it.

Pioneer
Pioneer

Hi Jason,

thank you for the example you find for me.

In that example it is going on how to create a RefPlane in a Part Enviroment by SolidEdgePart.RefPlanes.AddBy3points.

Here, what I don't understand, the Spy shows that Object of EdgeSet is needed:

SolidEdgePart.RefPlane.AddBy3Points(Int32 NumEdges, ref Object[] EdgeSet, ref SolidEdgeFramework.KeyPointType[] KeyPointTypeConstants, [Object Local])

but Visual Basic Object Browser shows:

AddBy3Points(NumEdges As Integer, ByRef EdgeSet As System.Array, ByRef KeyPointTypeConstants As System.Array, Optional Local As Object) As SolidEdgePart.RefPlane

 

In the example, the objects are obtained by SolidEdgeGeometry.CurveBody.Curves(x)
The property returns Curve object for the referenced CurveBody or CurvePath object.

 

My issue is to create RefPlane in the Assembly by SolidEdgeAssembly.AsmRefPlane.AddBy3Points, where Objects of points needed(here the Spy and the Obj.Browser in VB says the same):
SolidEdgeAssembly.AsmRefPlane.AddBy3Points(Object RootPoint, Object SecondXAxisPoint, Object ThirdPoint)

I was looking for long time to find property which returns 3d point as Object (for example as endpoint of 3Dsketch line) Unfortunately, all properties I found returns just arrays of Double, but this can't be used in AsmRefPlane.AddBy3Points method.

 

So there is any way how to obtain endpoints of 3dLines in 3dSketches as Objects? Or keypoints of occurences in assembly as Objects?

 

Thank you

 

Lubos

 

Re: Creating plane with AddBy3Points - how to obtain Points of type Objects for creating it.

Pioneer
Pioneer

Finally I got it Smiley Happy , I created objects from points by using AssemblyDocument.CreateReference(Occurence, Entity)

I found it in one of Jasons sample - thank you! 

 

 

The working part of code looks like this:

...

Dim MyApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application")
Dim MyAsm As SolidEdgeAssembly.AssemblyDocument = MyApp.ActiveDocument

Dim Occs As SolidEdgeAssembly.Occurrences = MyAsm.Occurrences
Dim Occ As SolidEdgeAssembly.Occurrence

Dim oEdge As SolidEdgeGeometry.Edge


Occ = Occs.Item(1)

oEdge = Occ.OccurrenceDocument.Models.Item(1).Body.Shells.Item(1).Edges.Item(1)

 

Dim objPoint1 As Object = MyAsm.CreateReference(MyOcc, Entity:=oEdge.StartVertex)

Dim objPoint2 As Object = MyAsm.CreateReference(MyOcc, Entity:=oEdge.EndVertex)

 

Occ = Occs.Item(2)

oEdge = Occ.OccurrenceDocument.Models.Item(1).Body.Shells.Item(1).Edges.Item(1)

 

Dim objPoint3 As Object = MyAsm.CreateReference(MyOcc, Entity:=oEdge.StartVertex)

 

MyAsm.AsmRefPlanes.AddBy3Points(objPoint1, objPoint2, objPoint3)

..

 

This create plane by 3 points which are obtained from keypoints of more objects.

 

Lubos