Solid Edge Part Type Library
MeasureAngleEx Method
The first element that forms the angle to measure.
The second element that forms the angle to measure.
The third element that forms the angle to measure.
Returns angle in radians.
Returns angle in radians.
Returns angle in radians.
Returns angle in radians.
Description
Measure angle between 3 elements.
Syntax
Visual Basic
Public Sub MeasureAngleEx( _
   ByVal Element1 As Object, _
   ByVal Element2 As Object, _
   ByVal Element3 As Object, _
   ByRef Angle1 As Double, _
   ByRef Angle2 As Double, _
   ByRef Angle3 As Double, _
   ByRef Angle4 As Double _
) 
Parameters
Element1
The first element that forms the angle to measure.
Element2
The second element that forms the angle to measure.
Element3
The third element that forms the angle to measure.
Angle1
Returns angle in radians.
Angle2
Returns angle in radians.
Angle3
Returns angle in radians.
Angle4
Returns angle in radians.
Example
Imports System.IO
Imports System.Runtime.InteropServices

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objApp As SolidEdgeFramework.Application
        Dim objPartDoc As SolidEdgePart.PartDocument = Nothing
        Dim objDocuments As SolidEdgeFramework.Documents = Nothing
        Dim objFolder As DirectoryInfo
        Dim objFileInfo As FileInfo
        Dim distance As Double
        Dim dx As Double
        Dim dy As Double
        Dim dz As Double
        Dim dgoem(2) As Double
        Dim featedges As SolidEdgeGeometry.Edges
        Dim featedge1 As SolidEdgeGeometry.Edge
        Dim featedge2 As SolidEdgeGeometry.Edge
        Dim featedge3 As SolidEdgeGeometry.Edge
        Dim objFace1 As SolidEdgeGeometry.Face
        Dim objFace2 As SolidEdgeGeometry.Face
        Dim dblPoint1(0) As Double
        Dim dblPoint2(0) As Double
        Dim dblPoint3(0) As Double
        Dim angle1 As Double
        Dim angle2 As Double
        Dim angle3 As Double
        Dim angle4 As Double
        Dim SurfArea As Double
        Dim Volume As Double
        Dim Length As Double
        Dim coSyss As SolidEdgePart.CoordinateSystem

        dgoem(0) = 0
        dgoem(1) = 0
        dgoem(2) = 0

        Try
            objApp = Marshal.GetActiveObject("SolidEdge.Application")
            objFolder = GetTrainingFolder()
            objFileInfo = New FileInfo(Path.Combine(objFolder.FullName, "anchor.par"))
            objDocuments = objApp.Documents
            objPartDoc = objDocuments.Open(objFileInfo.FullName)
            objFace1 = objPartDoc.Models.Item(1).ExtrudedProtrusions.Item(1).Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll).Item(1)
            objFace2 = objPartDoc.Models.Item(1).ExtrudedProtrusions.Item(1).Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll).Item(2)

            Call objPartDoc.MeasureDistance(objFace1, objFace2, SolidEdgePart.MeasureDistanceTypeConstants.MeasureDistanceTypeConstants_MaximumDistance, distance, dx, dy, dz, dblPoint1, dblPoint2)
            MsgBox("Distance between the elements is " + distance.ToString)
            featedges = objPartDoc.Models.Item(1).ExtrudedProtrusions.Item(2).Edges(SolidEdgeConstants.FeatureTopologyQueryTypeConstants.igQueryAll)
            featedge1 = featedges.Item(18)
            featedge2 = featedges.Item(19)
            featedge3 = featedges.Item(20)
            Call objPartDoc.MeasureAngleEx(featedge1, featedge2, featedge3, angle1, angle2, angle3, angle4)
            MsgBox("Angle between the edges is " + Math.Round(RadiansToDegrees(angle1)).ToString + " degrees")

            Call objPartDoc.InquireElement(featedge1, dgoem, Nothing, dblPoint1, SurfArea, Volume, Length)

            coSyss = objPartDoc.CoordinateSystems.Item(1)

            Call objPartDoc.InquireElement(featedge1, dblPoint2, coSyss, dblPoint3, SurfArea, Volume, Length)
            MsgBox("Length of Inquired Element is " + Length.ToString)
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
            Clipboard.SetText(ex.ToString)
        End Try
    End Sub
    Private Function RadiansToDegrees(ByVal radians As Double) As Double
        Return radians * (180 / Math.PI)
    End Function
    Function GetTrainingFolder() As DirectoryInfo
        Dim objInstallData As SEInstallDataLib.SEInstallData = Nothing
        Dim objInstallFolder As DirectoryInfo = Nothing
        Dim objTrainingFolder As DirectoryInfo = Nothing

        Try
            objInstallData = New SEInstallDataLib.SEInstallData
            objInstallFolder = New DirectoryInfo(objInstallData.GetInstalledPath())
            objTrainingFolder = New DirectoryInfo(Path.Combine(objInstallFolder.Parent.FullName, "Training"))
        Catch
        Finally
            If Not (objInstallData Is Nothing) Then
                Marshal.FinalReleaseComObject(objInstallData)
                objInstallData = Nothing
            End If
        End Try

        Return objTrainingFolder
    End Function


End Class
See Also

PartDocument Object  | PartDocument Members