Refplanes.AddBy3Points

Genius
Genius

I try to create a ReferencePlane in Sheetmetal with 3 Points of 2 selected Edges.

 

I don't know how to define EdgeSet() and KeyPointTypeConstants().

Can someone give me a few hints?

 

regards

Gerald

 

5 REPLIES

Re: Refplanes.AddBy3Points

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hello @Gerald,

The EdgeSet is an array of 3 Edges or 2D Geometry in a sketch.

These can be lines, circles (arcs), ellipses or splines.

The points to be used are identified by the corresponding entries in the KeyPointTypeConstants array.

Think of a  line that has a start, end an mid point. So the set of usable KeyPointType values depends

on the type of the current Edge element.

 

regards

JB
VS2015, SE ST10

Re: Refplanes.AddBy3Points

Genius
Genius

Hello @JB,

thank you for your answer, I tried exactly this without success. 

 

Dim KPC(2) As SolidEdgeConstants.KeyPointType

I got a tooltip:

Value of type 'SolidEdgeConstants.KeyPointType cannot be converted to 'System.Array'.

 

Does your Code work for you?

 

regards Gerald

VS 2013

SE ST8

Re: Refplanes.AddBy3Points

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hello @Gerald,

I had no code. So I just made a small test program.

Using the SolidEdge.Community NuGet Package this Code will create a RefPlane.

You have to convert to System.Array in the code if Option Strict is On.

  Dim SEApp As SolidEdgeFramework.Application
    Dim SEPart As SolidEdgePart.PartDocument

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.Text = My.Application.Info.Description

        Dim NewRefPlane As SolidEdgePart.RefPlane

        Try
            ' Register with OLE to handle concurrency issues on the current thread.
            SolidEdgeCommunity.OleMessageFilter.Register()

            ' Connect to or start Solid Edge.
            SEApp = SolidEdgeCommunity.SolidEdgeUtils.Connect(True, True)

            ' Get path to Solid Edge training directory.  Typically, 'C:\Program Files\Solid Edge XXX\Training'.
            Dim trainingDirectory As New DirectoryInfo(SolidEdgeCommunity.SolidEdgeUtils.GetTrainingFolderPath())

            ' Build path to file.
            Dim filename As String = Path.Combine(trainingDirectory.FullName, "body.par")

            SEPart = DirectCast(SEApp.Documents.Open(filename), SolidEdgePart.PartDocument)

            Dim InputEdges(2) As Object
            Dim KPC(2) As SolidEdgeConstants.KeyPointType

            ' Get Edges by index
            InputEdges(0) = GetEdgeByID(SEPart, 449)
            InputEdges(1) = InputEdges(0)
            InputEdges(2) = GetEdgeByID(SEPart, 6)
            ' Define the KeyPoints
            KPC(0) = SolidEdgeConstants.KeyPointType.igKeyPointStart
            KPC(1) = SolidEdgeConstants.KeyPointType.igKeyPointEnd
            KPC(2) = SolidEdgeConstants.KeyPointType.igKeyPointStart
            ' Create the new RefPlane
            Dim RPlanes As SolidEdgePart.RefPlanes = SEPart.RefPlanes
            NewRefPlane = RPlanes.AddBy3Points(3,
                    InputEdges,
                    KPC,
                    False)
            ' use this if Option Strict On
            NewRefPlane = RPlanes.AddBy3Points(3,
                    CType(InputEdges, System.Array),
                    CType(KPC, System.Array),
                    False)

        Catch ex As Exception
        End Try

    End Sub
regards

JB
VS2015, SE ST10

Re: Refplanes.AddBy3Points

Genius
Genius

Hello @JB,

 

it still does not work for me, i get aSystem.IO.FileNotFoundException for SolidEdgeFramework??

I can do the job with AddPlanarByDistance.

 

Thank you for your help!

regards

Gerald

 

Re: Refplanes.AddBy3Points

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
Hi, I assume you have problems with the references Interop Assemblies.
Try to delete the Solid Edge Interops and create new.
I used the Community Interop.SolidEdge NuGet package.
regards

JB
VS2015, SE ST10