Option Infer On
Imports System
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim partDocument As SolidEdgePart.PartDocument = Nothing
Dim models As SolidEdgePart.Models = Nothing
Dim model As SolidEdgePart.Model = Nothing
Dim body As SolidEdgeGeometry.Body = Nothing
Dim faces As SolidEdgeGeometry.Faces = Nothing
Dim face As SolidEdgeGeometry.Face = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
' C:\Program Files\Solid Edge STX\Training\base.par
partDocument = CType(application.ActiveDocument, SolidEdgePart.PartDocument)
models = partDocument.Models
model = models.Item(1)
body = CType(model.Body, SolidEdgeGeometry.Body)
faces = CType(body.Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll), SolidEdgeGeometry.Faces)
face = CType(faces.Item(6), SolidEdgeGeometry.Face)
Dim EdgesArray = Array.CreateInstance(GetType(Object), 0)
Dim BrType = SolidEdgeConstants.FeaturePropertyConstants.igNone
Dim dBRWidth As Double = 0.001
Dim dBRLength As Double = 0.0
Dim dBendRadius As Double = 0.001
Dim dNeutralFactor As Double = 0.0
partDocument.TransformToSynchronousSheetmetal(face, 0, EdgesArray, BrType, dBRWidth, dBRLength, dBendRadius, dNeutralFactor)
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
using System;
using System.Runtime.InteropServices;
namespace Examples
{
class Program
{
[STAThread]
static void Main(string[] args)
{
SolidEdgeFramework.Application application = null;
SolidEdgePart.PartDocument partDocument = null;
SolidEdgePart.Models models = null;
SolidEdgePart.Model model = null;
SolidEdgeGeometry.Body body = null;
SolidEdgeGeometry.Faces faces = null;
SolidEdgeGeometry.Face face = null;
try
{
// See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register();
// Attempt to connect to a running instance of Solid Edge.
application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
// C:\Program Files\Solid Edge STX\Training\base.par
partDocument = (SolidEdgePart.PartDocument)application.ActiveDocument;
models = partDocument.Models;
model = models.Item(1);
body = (SolidEdgeGeometry.Body)model.Body;
faces = (SolidEdgeGeometry.Faces)body.Faces[SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll];
face = (SolidEdgeGeometry.Face)faces.Item(6);
var EdgesArray = Array.CreateInstance(typeof(object), 0);
var BrType = SolidEdgeConstants.FeaturePropertyConstants.igNone;
double dBRWidth = 0.001;
double dBRLength = 0.0;
double dBendRadius = 0.001;
double dNeutralFactor = 0.0;
partDocument.TransformToSynchronousSheetmetal(face, 0, ref EdgesArray, BrType, dBRWidth, dBRLength, dBendRadius, dNeutralFactor);
}
catch (System.Exception ex)
{
Console.WriteLine(ex);
}
finally
{
OleMessageFilter.Unregister();
}
}
}
}