×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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

Jobs

Revision Parts Drawing and Assemblies Api

Revision Parts Drawing and Assemblies Api

Revision Parts Drawing and Assemblies Api

(OP)
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.

CODE --> C#

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");
                } 
I just need pointing in the direction than i can get there by myself.

Thanks.

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!


Resources