-
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 21, 2017 11:43 AM (in response to Deepak Gupta)Thank you for the quick response.
Didnt work for me. it stopped at last line highlighted by you.
My requirement is to run this macro on all parts + assemblies in the specified folder to add custom properties( as stated in macro) and save and close them.
Can you please share it as an attachment here? I do not have much experience in programming so it would be really helpful.
-
Re: BatchMacro lines to save and close part before opening next
Deepak Gupta Apr 21, 2017 11:45 AM (in response to Alpeshkumar Patel)This macro works on an active assembly file only. For batch running you can use #TASK
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 21, 2017 11:56 AM (in response to Deepak Gupta)Thank you Deepak,
I tried to refer that first before going on Macro Route but couldn't get it working.
Can you pls help me to update this macro for these tasks.
Open all parts from a specified folder and update custom properties?
-
Re: BatchMacro lines to save and close part before opening next
Deepak Gupta Apr 21, 2017 12:03 PM (in response to Alpeshkumar Patel)Alpeshkumar Patel wrote:
I tried to refer that first before going on Macro Route but couldn't get it working.
You need to register before using #TASK So what is the issue you're getting in using it.
For macro, try the one in this post: https://forum.solidworks.com/message/454641#comment-454641
You can also use task scheduler to update properties.
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 21, 2017 12:32 PM (in response to Deepak Gupta)I have registered in it and can see some online tasks available.
I picked Custom properties manager task and it can add it but the issue is if any part has existing similar properties it just over writes it. That is causing me an issue as some of the filled parameters are also wiping out with this task which was not the case for that macro.
In task scheduler : when I choose custom task to run it from single file macro, I dont see option to see target folder from where it would pick up files. When I choose task to update custom properties, I need to type every property each time and it is not taking the list from any part or excel.
@ Post : I tried merging this macro with my macro to convert it into batch but has error that " Part is not deifined.". Can you pls have a look on this attached one and fix the error for me ?
-
Batch Update Properties.swp.zip 13.9 KB
-
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 21, 2017 2:19 PM (in response to Deepak Gupta)I want to update this attached macro to Batch macro.
List of custom properties are added in it.
-
Add Custom Property.swp.zip 9.3 KB
-
Re: BatchMacro lines to save and close part before opening next
Deepak Gupta Apr 22, 2017 1:53 AM (in response to Alpeshkumar Patel)Alpesh, here is updated macro which works on part and assembly in the selected folder.
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 24, 2017 9:07 AM (in response to Deepak Gupta)Thank you . I appreciate it.
-
-
-
-
-
-
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 21, 2017 12:01 PM (in response to Deepak Gupta)I think I got one task where it can run to add predefined properties.
Thank you.
-
-
-
-
Re: BatchMacro lines to save and close part before opening next
Raghvendra Bhargava Apr 21, 2017 2:35 PM (in response to Alpeshkumar Patel)Hi Alpesh,
Try attached macro.I updated your macro.
It will open Browse folder Box to select your specific folder then it will open only Part and assembly file.
CHEERS!!
-
OpenSave_PartAsm.txt.zip 1.0 KB
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 21, 2017 6:43 PM (in response to Raghvendra Bhargava)Thank you RB, Its working perfectly fine when folder has only part files. But when it has drawing or assembly files the macro is failing.
I want to add these parameters to all 3D parts and will have separate macros to pull associated parts' properties in drawing.
Can you pl update this my updated macro so it does run same script on all SW files in that folder including assembly files and ignore drawings( and not fail) ?
I appreciate it.
-
Re: BatchMacro lines to save and close part before opening next
Raghvendra Bhargava Apr 21, 2017 8:24 PM (in response to Alpeshkumar Patel)Hi AP,
What actually is failing, is it an opening of assembly or drawing?
As per the logic, it should only open Part and Assembly file in the given folder.
Please also check that 'File Name Extension' is ON for your folder.
Thanks
-
Re: BatchMacro lines to save and close part before opening next
Alpeshkumar Patel Apr 24, 2017 9:06 AM (in response to Raghvendra Bhargava)Hello RB,
On that day when I run this, it open 2 part files and on 3rd it fails. I tried deleting drawings files but only keeping part+assly but the same result. Then I tried removing assembly files from the folder and the macro runs on all files.
Update : Today I created another test folder and put random files. This macro doesnt fail and updated all part+assly files.
Thank you.
-
-
-