[TS6] Get shapes separately

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, Daniel, jacs

gmanucci
Master Corporal
Master Corporal
Posts: 49
Joined: Tue Sep 29, 2015 2:48 pm
TopSolid Module: TopSolid'Cam
TopSolid Version: 7.4

[TS6] Get shapes separately

Unread post by gmanucci » Thu Jul 07, 2016 6:38 pm

Hello!

I'm trying to do an automation that exports all shapes into separately files.

i tried something like this:

Code: Select all

	private void button1_Click(object sender, EventArgs e)
        {

            TopSolid.Application MyApp = new TopSolid.Application();

            MyApp.ProgramUnitAngle = "deg";
            MyApp.ProgramUnitLength = "mm";

            MainDocument = (Document)MyApp.ActiveDocument;

            foreach (TopSolid.Element elmnt in MainDocument.Shapes)
            {
                try
                {
                    elmnt.SaveInFile(@"C:\Users\g.manucci\Desktop\teste", elmnt.Designation, TopInterface.topInterfaceTop);
                }
                catch { }
            }
        }
this code in some elements return more than one shape ):

Thanks in advance,

User avatar
JuP
Master Chief
Master Chief
Posts: 127
Joined: Tue Sep 09, 2014 5:45 pm
TopSolid Module: TopSolid'Design
TopSolid Version: 7.12

Re: [TS6] Get shapes separately

Unread post by JuP » Fri Jul 08, 2016 6:52 am

Hi Gmanucci,

In the bad cases, shapes have something common between them?
Julien POIROT
TopSolid'Steel Product Manager
Youtube
GrabCad
Facebook

gmanucci
Master Corporal
Master Corporal
Posts: 49
Joined: Tue Sep 29, 2015 2:48 pm
TopSolid Module: TopSolid'Cam
TopSolid Version: 7.4

Re: [TS6] Get shapes separately

Unread post by gmanucci » Tue Jul 12, 2016 8:15 pm

Hey!

Yes, they have ):

User avatar
JuP
Master Chief
Master Chief
Posts: 127
Joined: Tue Sep 09, 2014 5:45 pm
TopSolid Module: TopSolid'Design
TopSolid Version: 7.12

Re: [TS6] Get shapes separately

Unread post by JuP » Wed Jul 13, 2016 8:04 am

And what?

Maybe they have the same Id / name or it's shapes with operations which have put them invisible. :?
Julien POIROT
TopSolid'Steel Product Manager
Youtube
GrabCad
Facebook

gmanucci
Master Corporal
Master Corporal
Posts: 49
Joined: Tue Sep 29, 2015 2:48 pm
TopSolid Module: TopSolid'Cam
TopSolid Version: 7.4

Re: [TS6] Get shapes separately

Unread post by gmanucci » Wed Jul 13, 2016 1:04 pm

Can it be caused by setting a panel in TS'Wood?

The top file is something like a shelf, and has its parts defined as panel.

Thanks for replying,

User avatar
JuP
Master Chief
Master Chief
Posts: 127
Joined: Tue Sep 09, 2014 5:45 pm
TopSolid Module: TopSolid'Design
TopSolid Version: 7.12

Re: [TS6] Get shapes separately

Unread post by JuP » Wed Jul 13, 2016 3:43 pm

yes probably because when you make a panel TopSolid make the original part invisible :roll:

I don't know the API with de V6 but maybe you can test if the shape is invisible

Edit:
Property (bool):
IElement.Blanked

Method(bool):
IElement.Visible

You can see more informations on the TopSolid Automation API Help.

Good luck ! :wink:
Julien POIROT
TopSolid'Steel Product Manager
Youtube
GrabCad
Facebook

Post Reply