Page 1 of 1

[TS6] Get shapes separately

Posted: Thu Jul 07, 2016 6:38 pm
by gmanucci

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)
                    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,

Re: [TS6] Get shapes separately

Posted: Fri Jul 08, 2016 6:52 am
by JuP
Hi Gmanucci,

In the bad cases, shapes have something common between them?

Re: [TS6] Get shapes separately

Posted: Tue Jul 12, 2016 8:15 pm
by gmanucci

Yes, they have ):

Re: [TS6] Get shapes separately

Posted: Wed Jul 13, 2016 8:04 am
by JuP
And what?

Maybe they have the same Id / name or it's shapes with operations which have put them invisible. :?

Re: [TS6] Get shapes separately

Posted: Wed Jul 13, 2016 1:04 pm
by gmanucci
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,

Re: [TS6] Get shapes separately

Posted: Wed Jul 13, 2016 3:43 pm
by JuP
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

Property (bool):


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

Good luck ! :wink: