Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


macro to save multiple parts in a desired format (3d xml, stp )

macro to save multiple parts in a desired format (3d xml, stp )

macro to save multiple parts in a desired format (3d xml, stp )

While using the code given in the https://www.eng-tips.com/viewthread.cfm?qid=347231 Macro to rename and save all unique parts in a product an error regarding 'save as' pops up .
can someone post generalized macro to save cat parts , cat products etc in desired formats like 3dxml , stp etc.

Option Explicit
Sub CATMain()
Dim iCount As Integer
Dim sSuffix As String
Dim sNewName As String
sSuffix = "_00"

'To avoid save as warnings*********
CATIA.DisplayFileAlerts = False

Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument

Dim product1 As Product
Set product1 = productDocument1.Product
Dim doc1 As Document
Dim products1 As Products
Set products1 = product1.Products

For iCount = 1 To products1.Count
products1.Item(iCount).PartNumber = products1.Item(iCount).PartNumber & sSuffix
sNewName = products1.Item(iCount).PartNumber
Dim documents1 As Documents
Set documents1 = CATIA.Documents

iCount = iCount + 1
Set doc1 = documents1.Item(iCount)
doc1.SaveAs " C:\Users\kpravars\Desktop\test\" & sNewName & ".CATPart"
iCount = iCount - 1
Next iCount
End Sub

my task requires me to just save all the catparts and catproducts in a given installation locally in the specific folder (preferably in STP format).
thanks in advance .

RE: macro to save multiple parts in a desired format (3d xml, stp )

the problem is as shown in the image I need to save all the parts in specific format .Ex- Single parts as individual STP files , and assemblies as individual STP files .

RE: macro to save multiple parts in a desired format (3d xml, stp )

I have to upload cat parts from local folder and get them converted into the required format if I use Utility option . I don't have the catparts (installation 3d models) saved locally . I load them from ENOVIA and have to save each locally in the required STP , 3dxml format .If it can be done by utility option please tell me how .
Thanks in advance

RE: macro to save multiple parts in a desired format (3d xml, stp )

Sorry for that .Can you help me in customizing the above code in order to save parts in required format !.

RE: macro to save multiple parts in a desired format (3d xml, stp )

That code will not work in this case, you have to think a little bit out of the box.

You can do a custom query in ENOVIA and load from there in your CATIA session your desired parts. Then, with a macro, you can export and close one by one your files (export on a local folder).

This can be done also in another way but I suppose you are not an admin in ENOVIA (and again, you need also license to do this).

By the way, did you tried to do this manually?


https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: macro to save multiple parts in a desired format (3d xml, stp )

I tried .The main problem is single parts inside the assembly get saved ( instead of assembly as a product itself) , so it creates a problem .If somehow I can save single parts as CATParts and assemblies as CATProducts in one shot it will make work easier.

RE: macro to save multiple parts in a desired format (3d xml, stp )

hello ,
still waiting for the macro .
any help will be great !.
thanks in advance :)

RE: macro to save multiple parts in a desired format (3d xml, stp )

really? and we are still waiting to see your progress in trying to solve it on your own :)


RE: macro to save multiple parts in a desired format (3d xml, stp )

Did you asked a specialized company for a quotation to do this ?
ans- No , this is my own study in minimizing the efforts required to perform the task (saving files in STP , 3dxml format)

Did you asked your DS VAR for a solution for your problem ?
ans - No , because the above code which I customized seems almost complete . Because I have already written a code to load CATParts , CATProducts from local and save them in STP , 3dxml format . Here in this case as I load the installation (CATProduct) which child products when I try to save locally only single parts get saved ( all the single parts , including the ones in child CTProducts).
So when I try to convert them into stp or 3dxml by importing them from local files only single part SP or 3dxml gets generated and child CATProducts are not saved .This part is bugging me - how to save installation locally as it is ( as the given tree structure ).

Did you tried to do some code ? What you noticed ?
Yea , the above mentioned at the start of the thread is what I tried which throws an error. After that I did not try anything else yet.

RE: macro to save multiple parts in a desired format (3d xml, stp )

If I understood well, you cannot save CATProduct from ENOVIA to local folders. For this, you need to use SendTo Directory.

Another idea is to get names and position of the CATParts/CATProducts from your CATproduct in ENOVIA and rebuild the CATProduct locally using data extracted before.

Another idea is to make an AllCATPart from CATProduct, then break it in a local CATProduct (you can use another macro for this) and replace those new created parts with yours (if is necessary) to have the CATProduct from ENOVIA.

After this, using the right license shouldn't be a problem to convert to what ever you want. But if you convert to stp or 3dxml I suppose you don't even need to do the replacement.

Sometimes you cannot achieve the final goal in a single step...

By the way, management should think about how much time take to a user/developer to do something instead of buying a solution already done (of course, you need to do the math in terms of time, money, a.s.o. and see what is more convenient).


https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


3D Scanning in the Automotive Industry
With over 100 years of production history, the automotive industry has been at the forefront of manufacturing technology since its inception. Whether the transformative technology of the day was the assembly line, the integration of robotics into the manufacturing process, or the switch from steel to aluminum frame chasses, the automotive industry has consistently implemented advanced technology into its manufacturing and production workflow to improve manufacturing and product performance. Today, the same is true. Download Now
Green light on lidar: Developing low cost systems for autonomous vehicles
Lidar has been around for quite some time, but to date, it’s been custom—and expensive. Right now, there isn’t a clear-cut solution that’s suitable for all applications, such as lidar in autonomous vehicles. As they explore options, optical and mechanical engineers are forced to make choices and tradeoffs during the design process. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close