许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  Creo Open PRT文件操作指南

Creo Open PRT文件操作指南

阅读数 4203
点赞 71
article_banner

https://community.ptc.com/t5/Assembly-Design/ProE-VBA-API-examples/td-p/44157

This example connects to an open Pro/ENGINEER session and retrieves part PRT0001 and access its Family table instances and displays their names.


Sub Main2()
'
' This routine will open a Pro/E file from your WorkingDirectory in a new window:
'
Dim asynconn As New pfcls.CCpfcAsyncConnection
Dim conn As pfcls.IpfcAsyncConnection
Dim session As pfcls.IpfcBaseSession
Dim oModel As pfcls.IpfcModel

'Make an asynchronous connection with Pro/ENGINEER
Set conn = asynconn.Connect("", "", ".", 5)

'Get the current session
Set session = conn.session

'Show the current Working Directory
MsgBox "This is the current Working Directory: " & vbCrLf & session.GetCurrentDirectory

'Create a modeldescriptor to the Pro/E Model
Dim oModelDescriptorCreate As New CCpfcModelDescriptor
Dim oModelDescriptor As IpfcModelDescriptor
Set oModelDescriptor = oModelDescriptorCreate.Create(EpfcMDL_PART, "PRT0001.PRT", Null)

'Retrieve the model into the oModel handle
Set oModel = session.RetrieveModel(oModelDescriptor)


'Create a new window which displays the Pro/E Model
Dim oWindow As pfcls.IpfcWindow
Set oWindow = session.OpenFile(oModelDescriptor)

'Activate the new window
oWindow.Activate


'Show the name of the Pro/E Model in a messagebox
MsgBox "Model name = " & oModel.Filename
'
Dim A As IpfcBaseParameter
Dim Av As IpfcParamValue
Dim newA As IpfcParamValue
Dim A_value As Double
Dim generic As IpfcFamilyMember
Dim rows As IpfcFamilyTableRows
Dim row As IpfcFamilyTableRow
Dim InstName As String

'Declare (make) the Model as a IpfcFamilyMember type object
Set generic = oModel
' list the ROws of family table. If the part is not a generoc, there will be 0 rows
Set rows = generic.ListRows()

' Now, get each row and print the instance name. Once each instance is obtained, do rewquired operations
For Each row In rows
InstName = row.InstanceName
MsgBox "Fam Instance Name: " & InstName
Next

'Disconnect with Pro/ENGINEER
conn.Disconnect (2)

'Cleanup
Set asynconn = Nothing
Set conn = Nothing
Set session = Nothing
Set oModel = Nothing

End Sub

武汉格发信息技术有限公司,格发许可优化管理系统可以帮你评估贵公司软件许可的真实需求,再低成本合规性管理软件许可,帮助贵司提高软件投资回报率,为软件采购、使用提供科学决策依据。支持的软件有: CAD,CAE,PDM,PLM,Catia,Ugnx, AutoCAD, Pro/E, Solidworks ,Hyperworks, Protel,CAXA,OpenWorks LandMark,MATLAB,Enovia,Winchill,TeamCenter,MathCAD,Ansys, Abaqus,ls-dyna, Fluent, MSC,Bentley,License,UG,ug,catia,Dassault Systèmes,AutoDesk,Altair,autocad,PTC,SolidWorks,Ansys,Siemens PLM Software,Paradigm,Mathworks,Borland,AVEVA,ESRI,hP,Solibri,Progman,Leica,Cadence,IBM,SIMULIA,Citrix,Sybase,Schlumberger,MSC Products...

相关文章
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空