Save 3DPart as .stl file in CATIA v6 (Please help me)
Save 3DPart as .stl file in CATIA v6 (Please help me)
(OP)
Hello everyone,
I've been spending days trying to solve this issue. I'm trying to write a VBA script that can export a 3D part to a STL file in V6, and I'm not able to find a solution. In V5, you could use something like:
But it CATIA v6, this is no longer valid (!). Does anyone of you know how to adapt the code above so it could work in V6?
Any hint is really appreciated!
Thanks
I've been spending days trying to solve this issue. I'm trying to write a VBA script that can export a 3D part to a STL file in V6, and I'm not able to find a solution. In V5, you could use something like:
CODE --> VBA
Dim myDoc as PartDocument Set myDoc = CATIA.ActiveDocument myDoc.exportData "Filename.stl", "stl"
But it CATIA v6, this is no longer valid (!). Does anyone of you know how to adapt the code above so it could work in V6?
Any hint is really appreciated!
Thanks





RE: Save 3DPart as .stl file in CATIA v6 (Please help me)
Methods
o Sub Export( Part ioPart)
Exports the sections curves of the section in a 3DShape representation this method assumes that you have created the Part in which you want to do the export
Returns:
The 3DShape Representation
Example:
Dim MyOpenEditor As Editor
Set myNewService = CATIA.GetSessionService("PLMNewService")
myNewService.PLMCreate "3DShape", myOpenEditor
Dim myPart As Part
Set myPart = CATIA.ActiveEditor.ActiveObject
mySection.Export myPart
o Sub ExportTo( CATBSTR iFormat,
CATBSTR iSavePath)
Exports the section into dxf/dwg formats. It takes inputs as type to which you want to export as "dxf" or "dwg" and path where you want to save exported file(without extension).
Example:
mySection.ExportTo "dxf", "c:\ExportDxf" (For export as dxf)
mySection.ExportTo "dwg", "c:\ExportDwg" (For export as dwg)
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Save 3DPart as .stl file in CATIA v6 (Please help me)
Thank you Ferdo for your reply, it's very much appreciated!
Unfortunately, I had already checked the export(Part ioPart) method and it doesn't allow a user to export a 3Dpart as a STL file. This latter method is made for the 2D exports of a section in a 3d part...
So, I guess we are back to square one :( ... Does anyone knows how to automate (with vb) the export of 3dparts as stl in CATIA v6?
Thanks
RE: Save 3DPart as .stl file in CATIA v6 (Please help me)
Ok, I'm sorry to bump my question on top, but I really need to find a solution on this one...
To me it's surprising that finding a solution to this problem is not straightforward, as I think it might be very likely for someone to look to automate the process of exporting part files. Anyway, so far, one method that seems promising is to use the "StartCommand" method like:
CODE --> VB
CATIA.StartCommand ("Export")But I'm stuck there, not knowing how to automatically name the part and choose "stl" as the format.
Does anyone has an idea?
Thanks a lot!
RE: Save 3DPart as .stl file in CATIA v6 (Please help me)
Thanks again Ferdo for your reply.
For those who are wondering, I finally succeeded to write a VBA script to automate the export as STL file process. My code is very far from being efficient or beautifully designed, it's messy, I won't say I'm proud of it, but it works perfectly fine and without any failure(s)! I thought it might be relevant to share it to others so I pasted it below. Before running it, you must have your product or part already opened in the editor. So here it is:
CODE --> VBA