Programmer's Guide > Solid Edge > Environments > Assembly > Working with Reference Planes |
A reference axis defines the axis of revolution for a revolved feature. Reference axes are usually created in the Profile environment when a user defines the profile of the revolution. Two objects—the collection object, RefAxes, and the instance object, RefAxis—are available to enable you to manipulate reference axes in your models.
The following programs connect to a running instance of Solid Edge, creates an Assembly document and places an assembly reference plane using the AddAngularByAngle method. Then the program creates a Part document and places a reference plane using the AddParallelByDistance method.
See Handling 'Application is Busy' and 'Call was Rejected By Callee' errors for information regarding the use of OleMessageFilter. |
Creating Reference Planes in Visual Basic .NET |
Copy Code
|
---|---|
Imports SolidEdgePart Imports System.Runtime.InteropServices Module Program <STAThread()> _ Sub Main() Dim objApplication As SolidEdgeFramework.Application = Nothing Dim objDocuments As SolidEdgeFramework.Documents = Nothing Dim objAssembly As SolidEdgeAssembly.AssemblyDocument = Nothing Dim objAsmRefPlanes As SolidEdgeAssembly.AsmRefPlanes = Nothing Dim objAsmRefPlane As SolidEdgeAssembly.AsmRefPlane = Nothing Dim objPPlane As SolidEdgeAssembly.AsmRefPlane = Nothing Dim objPart As SolidEdgePart.PartDocument = Nothing Dim objRefPlanes As SolidEdgePart.RefPlanes = Nothing Dim objRefPlane As SolidEdgePart.RefPlane = Nothing Try OleMessageFilter.Register() ' Connect to a running instance of Solid Edge objApplication = Marshal.GetActiveObject("SolidEdge.Application") ' Access the Documents collection object objDocuments = objApplication.Documents ' Add an Assembly document objAssembly = objDocuments.Add("SolidEdge.AssemblyDocument") ' Access the AsmRefPlanes collection object objAsmRefPlanes = objAssembly.AsmRefPlanes ' Create a reference plane at an angle to a ' principal reference plane objPPlane = objAsmRefPlanes.Item(2) ' Add a new reference plane objAsmRefPlane = objAsmRefPlanes.AddAngularByAngle( _ objPPlane, _ (2 * Math.PI / 3), _ objAsmRefPlanes.Item(1), _ ReferenceElementConstants.igPivotEnd, _ ReferenceElementConstants.igNormalSide, _ True) ' Add a Part document objPart = objDocuments.Add("SolidEdge.PartDocument") ' Access the RefPlanes collection object objRefPlanes = objPart.RefPlanes ' Create a global reference plane parallel to the top reference plane objRefPlane = objRefPlanes.AddParallelByDistance( _ objRefPlanes.Item(1), _ 0.1, _ ReferenceElementConstants.igNormalSide, _ False) Catch ex As Exception Console.WriteLine(ex.Message) Finally OleMessageFilter.Revoke() End Try End Sub End Module |
Creating Reference Planes in C# |
Copy Code
|
---|---|
using SolidEdgeFramework; using SolidEdgePart; using System; using System.Reflection; using System.Runtime.InteropServices; namespace SolidEdge.SDK { class Program { [STAThread] static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgeAssembly.AssemblyDocument assembly = null; SolidEdgeAssembly.AsmRefPlanes asmRefPlanes = null; SolidEdgeAssembly.AsmRefPlane asmRefPlane = null; SolidEdgeAssembly.AsmRefPlane pPlane = null; SolidEdgePart.PartDocument part = null; SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; try { OleMessageFilter.Register(); // Connect to a running instance of Solid Edge application = (SolidEdgeFramework.Application) Marshal.GetActiveObject("SolidEdge.Application"); // Access the Documents collection object documents = application.Documents; // Add an Assembly document assembly = (SolidEdgeAssembly.AssemblyDocument) documents.Add("SolidEdge.AssemblyDocument", Missing.Value); // Access the AsmRefPlanes collection object asmRefPlanes = assembly.AsmRefPlanes; // Create a reference plane at an angle to a principal // reference plane pPlane = asmRefPlanes.Item(2); // Add a new reference plane.Add a new reference plane asmRefPlane = asmRefPlanes.AddAngularByAngle( pPlane, (2 * Math.PI / 3), asmRefPlanes.Item(1), ReferenceElementConstants.igPivotEnd, ReferenceElementConstants.igNormalSide, true); // Add a Part document part = (SolidEdgePart.PartDocument) documents.Add("SolidEdge.PartDocument", Missing.Value); // Access the RefPlanes collection object refPlanes = part.RefPlanes; // Create a global reference plane parallel to the top // reference plane refPlane = refPlanes.AddParallelByDistance( refPlanes.Item(1), 0.1, ReferenceElementConstants.igNormalSide, false, Missing.Value, Missing.Value, Missing.Value); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { OleMessageFilter.Revoke(); } } } } |