packmen
Mechanical
- Aug 31, 2001
- 77
Hi everyone. I use to program in vba and i'm changing all macros to C#, I could just translate the code using the same logic but when I did it the first time i was very noob, I use string function Mid, Left, Right for almost everything. It works but is really ugly. I need to save as parts and assemblies using the following logic.
xxxxpprr.something where xxxx is a sequencial number, pp is the position in the weldment and rr is the revision number.
usually a weld 2 or more parts and make a welded assembly.
ex.:
10000100.sldprt and 10000100.slddrw are the firt position
10000200.sldprt and 10000200.slddrw are the second position
10000000.sldasm and 10000000.slddrw are the final welded assembly
When I revise just the first position I do the following.
open all parts and drawing
save as the parts I want to revise ex.:
10000101.sldprt and 10000101.slddrw
10000200.sldprt and 10000200.slddrw --> just keep the way they are, no saveas needed here.
10000001.sldasm and 10000001.slddrw --> the revision here is the sum of all parts revision.
I open one by one and saveas in the macro the same way would do so to keep the external reference updated.
There is a better way to do it? I've seen Solidworks Document Manager API, but i'm not under subscription anymore
"The SolidWorks Document Manager API requires a license key that is only available via the SolidWorks customer portal to SolidWorks customers who are currently under subscription."
I started open all files from a selection but I will wait some answers here to continue.
here is part of the code.
I just need pointing in the direction than i can get there by myself.
Thanks.
xxxxpprr.something where xxxx is a sequencial number, pp is the position in the weldment and rr is the revision number.
usually a weld 2 or more parts and make a welded assembly.
ex.:
10000100.sldprt and 10000100.slddrw are the firt position
10000200.sldprt and 10000200.slddrw are the second position
10000000.sldasm and 10000000.slddrw are the final welded assembly
When I revise just the first position I do the following.
open all parts and drawing
save as the parts I want to revise ex.:
10000101.sldprt and 10000101.slddrw
10000200.sldprt and 10000200.slddrw --> just keep the way they are, no saveas needed here.
10000001.sldasm and 10000001.slddrw --> the revision here is the sum of all parts revision.
I open one by one and saveas in the macro the same way would do so to keep the external reference updated.
There is a better way to do it? I've seen Solidworks Document Manager API, but i'm not under subscription anymore
"The SolidWorks Document Manager API requires a license key that is only available via the SolidWorks customer portal to SolidWorks customers who are currently under subscription."
I started open all files from a selection but I will wait some answers here to continue.
here is part of the code.
Code:
int count = swSelMgr.GetSelectedObjectCount();
if (count != 0)
{
//abre todos os arquivos parts e desenhos
for (int index = 1; index < count+1; index++)
{
if (swSelMgr != null)
{
//transforma os componentes selecionados em modeldocs
swCompo = (Component2)swSelMgr.GetSelectedObject6(index, -1);
swPart = (IModelDoc2)swCompo.GetModelDoc2();
//abre cada part da seleção
iSwApp.OpenDoc7(swPart);
//abre cada drawing da seleção
iSwApp.ActivateDoc(swPart.GetPathName());
string DrawingPath = swPart.GetPathName().Replace("PRT", "DRW");
iSwApp.OpenDoc(DrawingPath, (int)swDocumentTypes_e.swDocDRAWING);
}
else
Debug.WriteLine("seleção é nula");
}
Thanks.