Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creo VB API - Create new Part

  • Thread starter Thread starter GoWatzmann
  • Start date Start date
G

GoWatzmann

Guest
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.
 

Part and Inventory Search

Sponsor

Back
Top