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

GetMassProperty of a solid (VB API)

Highlighted
Level 12

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
1 REPLY 1

RE: GetMassProperty of a solid (VB API)

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