Solid Edge Part Type Library
InquireElement Method
Specify the first element to be inquired.
Specify coordinate system.
Returns the point.
Returns surface area if applicable
Returns volume if applicable.
Returns length if applicable.
Description
Gives information about elements.
Syntax
Visual Basic
Public Sub InquireElement( _
   ByVal Element As Object, _
   ByRef InPoint() As Double, _
   ByVal CoordinateSystem As Variant, _
   ByRef Point() As Double, _
   ByRef SurfaceArea As Double, _
   ByRef Volume As Double, _
   ByRef Length As Double _
) 
Parameters
Element
Specify the first element to be inquired.
InPoint
CoordinateSystem
Specify coordinate system.
Point
Returns the point.
SurfaceArea
Returns surface area if applicable
Volume
Returns volume if applicable.
Length
Returns length if applicable.
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