Mix of two macros_Composition to go

Hello

I have two pieces of code that work to make a take-home composition but I'd like to merge them to "mix" the actions performed.

In the text file "Folder choice", I can enter the path of the folder in which the pieces of the composition to be taken away should go and the name of the pieces remains the same as the original. That's what I want (maybe I'd add a suffix).

In the text file "Exclusion parts", I can exclude parts that contain a certain string in their name. On the other hand, I don't choose the destination folder and the name of the parts has nothing to do with the original one.

 

I therefore wish, via the two pieces of code, to be able to choose the destination folder of the parts while keeping their name and excluding those that contain certain characters.

Can you help me because I'm blocking?

I've tried several solutions (usually the macro runs fine) but I'm getting several results:

- the take-away composition is no longer done

- the parts are renamed

- the registration file is not the right one

 

Thanks in advance


composition_macro.zip
1 Like

Hello

 

While continuing my research, I came across this page: http://www.forum-cao-3d.fr/api-questions/macro-de-composition-a-emporter-t11454.html

I managed to delete the increment that renamed the files but I am stuck on the part that allows me to select the recording folder of the composition to take away.

At the moment, a dialog box opens, I can select a folder but the files of the composition to take with you don't go to the selected one.

How do I "Save the result in a variable of type String"?

Thank you


capture.png

Hello

Sorry I didn't have time to look at your problem.

Maybe next week...

To record as a string, simply:

dim x as string ' (or other name than X)

x = getfolder("Text to set")

That's what I used but as it was stated in the other post, I thought there was another line to add after to retrieve the result of selecting the folder in the Windows window.

Indeed, the getfolder works since the folder selection window opens but it seems that the choice made is not saved since the pieces of the composition to take away do not go in the selected folder.

I found the code that allows you to exclude components from the composition to take with you while choosing the destination folder.

The code is attached.

However, the basic assembly remains open and I would like it to be the one of the take-home composition that is displayed.

Do you know how to do it?


macro.txt

Hi, did the macro you used before open the takeaway composition? 

If so, can you attach the two codes in text files for me to look at?

Hi .PL,

No, the file displayed was also the original one.

I'm thinking of closing the original file and then opening the one of the composition to go. On the other hand, I don't know how to go about finding the assembly in the folder selected by the GetFolder function.

Another problem is that before the take-away composition, the macro modifies part dimensions directly in the assembly (sketch dimensions and an extrusion value).

When I open the assembly of the take-away composition, the dimensions are the original ones. However, if I open the part where the sketch dimensions were changed, then the assembly updates. On the other hand, for the part where I modify the value of the extrusion, if I open this part the extrusion value is the original one.

Anyone have an idea to update the assembly (if possible avoiding keeping the basic assembly after the modifications)?

Hello

I found the solution to my problem, the code is in the attached text file.

The steps are as follows:

 - Opening the base assembly

 - Take-home composition with choice of folder and basic names with prefix

 - Closing the base assembly

 - Extracting zipped files

 - Opening the part to be modified in the assembly

 - Modification of the part and then closure of it

 - Opening of the take-away composition assembly

 - Deleting the .zip file


macro.txt