create a profile on a coor sys

[ Edited ]


It's my first time I post on this forum, I use it a lot to search but I'm lost on this one.


I create and edit a part in an assembly.

Now I want to add a profile on the ZX plane of the coordinate system.

Here is my code so far:



Dim objApplication As SolidEdgeFramework.Application = Nothing

Dim objDocuments As SolidEdgeFramework.Documents = Nothing

Dim objassy As SolidEdgeAssembly.AssemblyDocument = Nothing

Dim objlayouts As SolidEdgeAssembly.Layouts = Nothing

Dim objlayout As SolidEdgeAssembly.Layout = Nothing

Dim objOccurances As SolidEdgeAssembly.Occurrences = Nothing

Dim objOccurance As SolidEdgeAssembly.Occurrence = Nothing

Dim objPart As SolidEdgePart.PartDocument = Nothing

Dim objProfileSets As SolidEdgePart.ProfileSets = Nothing

Dim objProfileSet As SolidEdgePart.ProfileSet = Nothing

Dim objProfiles As SolidEdgePart.Profiles = Nothing

Dim objProfile As SolidEdgePart.Profile = Nothing

Dim objCoorSyss As SolidEdgePart.CoordinateSystems = Nothing

Dim objCoorSys As SolidEdgePart.CoordinateSystem = Nothing

Dim objCoorPlane As SolidEdgeGeometry.Plane = Nothing

Dim objRelations2d As SolidEdgeFrameworkSupport.Relations2d = Nothing

Dim objRelation2d As SolidEdgeFrameworkSupport.Relation2d = Nothing

Dim objDims As SolidEdgeFrameworkSupport.Dimensions = Nothing

Dim objDim As SolidEdgeFrameworkSupport.Dimension = Nothing

Dim objLines2d As SolidEdgeFrameworkSupport.Lines2d = Nothing

Dim objLine2d As SolidEdgeFrameworkSupport.Line2d = Nothing

Dim objarcs2d As SolidEdgeFrameworkSupport.Arcs2d = Nothing

Dim objarc2d As SolidEdgeFrameworkSupport.Arc2d = Nothing

Dim objModels As SolidEdgePart.Models = Nothing

Dim objModel As SolidEdgePart.Model = Nothing

Dim objset As SolidEdgeFramework.SeObjectType = Nothing

Dim aProfiles AsArray

Dim sketch_name AsString

Const pi = 3.1415926535897931


' Connect to a running instance of Solid Edge

objApplication = Marshal.GetActiveObject("SolidEdge.Application")

' Get a reference to the documents collection

objDocuments = objApplication.Documents

' Connect to the assembly document

objassy = objApplication.ActiveDocument

' Get a reference to the layout sets collection

objlayouts = objassy.Layouts

' Get the selected layout

objlayout = objApplication.ActiveSelectSet.Item(1)

'get the name of the selected layout

sketch_name = objlayout.Name

'create part file

objOccurance = objassy.Occurrences.AddByTemplate(sketch_name & ".par")

'open the new part file



objPart = objApplication.ActiveDocument

' Get a reference to the profile sets collection

objProfileSets = objPart.ProfileSets

'Add a new profile set

objProfileSet = objProfileSets.Add()

' Get a reference to the profiles collection

objProfiles = objProfileSet.Profiles

' Get a reference to the Coor Systems collection

objCoorSyss = objPart.CoordinateSystems

'Connect to the first Coor System

objCoorSys = objCoorSyss.Item(1)

'objCoorPlane = objCoorSys.Plane(SolidEdgePart.CoordinateSystemFeatureConstants.seCoordSysZXPlane)

'Add a new profile

objProfile = objProfiles.Add(objCoorSys.Plane(3))


Thanks for your help.



Posted by: Stephan Morin
Post date: 10/26/2010 4:20:45 AM