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.

Vbapi - step csys

braynpower

New member
Hello everyone,

Could anyone clear up how to modify my code below to select a particular CSYS for export? I started having a hack at it myself, but to no avail.... I've tried looking in the examples, scoured PTC community, gone through vbug.pdf etc etc etc, but cant make heads nor tails of it. I'm pretty sure my hamfisted approach is wrong on many counts. I have no VBA training, no programming knowledge to speak of, just a will to persevere.

The Step export works, so if anyone has an idea, it would be really helpful!

'-------------------------------------------------------------------------------------------------------------

Dim DesEx As IpfcExportInstructions
Dim Des3DEx As IpfcExport3DInstructions
Dim DesExStep As IpfcSTEP3DExportInstructions
Dim cDesExStep As CCpfcSTEP3DExportInstructions
Dim DesFlags As IpfcGeometryFlags
Dim cDesFlags As CCpfcGeometryFlags
Dim DesG As Boolean
Dim DesC As Boolean
'Dim cSysS As IpfcModelItem '--------------------- I figure I need to declare some other stuff too....
Dim GenMod As IpfcModel
Dim GenOwn As IpfcModelItemOwner '---------------------- This seems to be necessary, but as later mentioned, cant get 3dexport instructions to select or use the csys....

Set GenMod = session.CurrentModel

'Set GenOwn = GenMod '------------------ not sure this is useful, but I'm doing my best

'Set cSysS = GenOwn.GetItemByName(EpfcFeatureType.EpfcFEATTYPE_COORD_SYS, "STEPEX") '------------------meh, this doesnt throw an error, but I cant use it afterwards.... grrrr

Set cDesFlags = New CCpfcGeometryFlags
Set DesFlags = cDesFlags.Create
DesFlags.AsSolids = True


DesC = session.IsConfigurationSupported(EpfcExportType.EpfcEXPORT_STEP, EpfcAssemblyConfiguration.EpfcEXPORT_ASM_FLAT_FILE)

'Msgbox ("DesC = " & DesC)

DesG = session.IsGeometryRepSupported(EpfcExportType.EpfcEXPORT_STEP, DesFlags)

'Msgbox ("DesG = " & DesG)

Set cDesExStep = New CCpfcSTEP3DExportInstructions
Set DesExStep = cDesExStep.Create(EpfcAssemblyConfiguration.EpfcEXPORT_ASM_FLAT_FILE, DesFlags)
Set Des3DEx = DesExStep
Set DesEx = Des3DEx '----------------- I tried messing with the instructions .ReferenceSystem, but then it complains of an unset block or variable... I figure I cant be a million miles off... but some way for sure

GenMod.Export SATempDir & SAPName & ".STP", DesEx
 

Sponsor

Articles From 3DCAD World

Back
Top