Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Creo VB API - Create new Part

GoWatzmann

New member
Hello,

i would create a new part using the default Template. Next Step ist to save the part.

Code:
Dim Session As pfcls.IpfcSession = AsyncConnection.Session
Dim BaseSession As pfcls.IpfcBaseSession = CType(session, pfcls.IpfcBaseSession)
Dim MyDocumentsPath As String = System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))
Dim WorkingDirectory As String = System.IO.Path.Combine(MyDocumentsPath, "CreoTest")
If System.IO.Directory.Exists(WorkingDirectory) = False Then System.IO.Directory.CreateDirectory(WorkingDirectory)
'set working directory
BaseSession.ChangeDirectory(WorkingDirectory)
'create new part
Dim Part As pfcls.IpfcPart = BaseSession.CreatePart(_Name:=NewPartName)
Dim Model As pfcls.IpfcModel = CType(Part, pfcls.IpfcModel)
'save part to working directory
Model.Save()
'display new part
Model.Display()

If I do it in this way, the part ist displayd in Creo, but it ist inactive. The ribbons are grayed and the feature tree ist not displayed. How kann i change this issue.
 

Sponsor

Articles From 3DCAD World

Back
Top