I need to check and rebuild the drawing if drawing already has a weld table in it. Else I need to create a weld table.
Check this out when you get a chance.
In the above example, where the macro uses SelectByID2, you'll see you can use this method to select a General Table ("GENERALTABLEFEAT"). You should similarly be able to accomplish your objective using an empty string for the first parameter in the SelectByID2 call, with "WELDMENTTABLEFEATS" as the second parameter.
You could then check to see what type of info - if any - is included in the variable after doing this to ascertain what must be done next.
Hope this helps provide direction!
PS - I should mention that I was able to find the syntax for Weld Tables within the API Help documentation.
Thanks but it just creates a general table and extracts the information from general table. It creates another table even if it already has a table. I need to stop the macro if it already has a table or skip it to next code in the macro.
Check this example which finds tables by type: Find tables from drawing by type using SOLIDWORKS API . Specify a filter for weld table and if returned array is empty - there are no tables in drawing.
Fifi Riri Can you please help? I need to avoid duplicating the table.
Did you see Artem Taturevych's reply? I think he has already answered your question.
Hello Nilesh, Yes I tried that and also inserted a code to break to code once it finds the weld table. But it gives me an error at upper bound.
Could you attach your macro and screenshot of the error that you are getting?
I just copy pasted the script into macro and ran it. I tried with no tables in the sheet, with only revision table in the sheet, with BOM in the sheet and with all revision, BOM and general table in the sheet.
Any help is appreciated.
Could you please share your file? I had similar complaint for this example before, but was not able to reproduce the issue (even with the sample model provided).Thanks,
First of all thanks for providing the source code.
Please check the attached files. The swp file is just a copy paste.
Let me know if there could be a solution.
Retrieving data ...