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.

[VB] Export Mdl to stepfile

Gravecat

New member
Dears


How should I do to export a 3D model to a step file?


At first I create a new 3D part model in the pro/e


Then,the code I try is following





Dim aC As IpfcAsyncConnection
Dim model As IpfcModel
Dim step3D As IpfcSTEP3DExportInstructions
Dim export3d As IpfcExport3DInstructions
Dim export As IpfcExportInstructions
Dim session As IpfcBaseSession
aC = (New CCpfcAsyncConnection).Connect("", "", ".", 5)
model = aC.session.CurrentModel
session = aC.Session


Dim tc As Boolean
Dim tg As Boolean
tc = session.IsConfigurationSupported(EpfcExportType.EpfcEXPORT_S TEP, EpfcAssemblyConfiguration.EpfcEXPORT_ASM_FLAT_FILE)
tg = session.IsGeometryRepSupported(EpfcExportType.EpfcEXPORT_STE P, (New CCpfcGeometryFlags).Create())
MsgBox(tc)
MsgBox(tg)



step3D = (New CCpfcSTEP3DExportInstructions).Create(EpfcAssemblyConfigurat ion.EpfcEXPORT_ASM_FLAT_FILE, (New CCpfcGeometryFlags).Create())
export3d = step3D
export = export3d
model.Export("D:\test\test01.stp", step3D)





But there is a exception in last row--pfcExceptions::XToolkitBadInputs


And the msgbox


MsgBox(tc)
MsgBox(tg)


both return false


how to solve tthis problem?
 
In this scenario assembly configuration should be checked.you are getting configurationSupported as false.First make sure you have right configuration and right representation.
 
Dear forstudy3


Thanks for your reply.So how do I set my configuration ? Is it a option in config?


My model is just a simple cylinder feature. I can use Menubar->File->save a copy to export my model to a stepfile. So I think my model is OK.
 
Dear forstudy3,


I figure out what's my problem. I input wrong parameter to the check funciton. So I chang my code to the follow


tc = session.IsConfigurationSupported(EpfcExportType.EpfcEXPORT_S TEP, EpfcAssemblyConfiguration.EpfcEXPORT_ASM_SINGLE_FILE)
Dim geoflag As IpfcGeometryFlags = (New CCpfcGeometryFlags).Create()
geoflag.AsSolids = True
tg = session.IsGeometryRepSupported(EpfcExportType.EpfcEXPORT_STE P, geoflag)

step3D = (New CCpfcSTEP3DExportInstructions).Create(EpfcAssemblyConfigurat ion.EpfcEXPORT_ASM_SINGLE_FILE, geoflag)





And it works.I export the currentmodel to step file successfully


Appreciation for your help.
 

Sponsor

Articles From 3DCAD World

Back
Top