cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

GetMassProperty of a solid (VB API)

Chris3
20-Turquoise

GetMassProperty of a solid (VB API)

I am attempting to write some VBA in Excel that connects to Pro/e and generates a mass properties report for an assembly and all of the components and sub components in it.

I am attempting to use the pfcSolidExamples.vb as a guide, but it uses CType which VBA doesn't support.

solid = CType(model, IpfcSolid)

If anyone has an idea about how to work around this or another way of doing it all together, I would appreciate it. Currently I generating the report with a combination of Pro/e Macros and a little VBA rather than using the API but that's not very robust as it seems like the macros need to be updated with every new release.

Christopher Rees - Mechanical Engineer - ISR Systems
UTC AEROSPACE SYSTEMS
100 Wooster Heights Rd, Danbury, CT 06810 U.S.A.
Tel: +1 203 797 5490 Fax: +1 203 797 6637
christopher.rees@utas.utc.com<">mailto:christopher.rees@utas.utc.com> www.utcaerospacesystems.com
This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 REPLY 1

Good morning,


in VB you don't need to use CType(), but you have to declare the correct variable types.


For example:


The method GetParam(sParamName)


So it is better to do it this way:


Dim hCurMdl As IpfcModel
Dim hParameterOwner As IpfcParameterOwnerDim
Dim hParameter As IpfcParameter


Set hCurMdl = hSession.CurrentModel
Set hParameterOwner = hCurMdl ' <<< this is the conversion you need...
Set hParameter = hParameterOwner.GetParam(sParamName)


...


Hope this helps...


Andreas


__________________________________


Andreas Hellmann
MCAD Services Pro/E & Pro/E customization
Am Wartfeld 7
D-61169 Friedberg


phone: +49 151 21259910

Top Tags