[TS6] Get shapes separately

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

Moderators: remi77, jacs, Daniel

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

[TS6] Get shapes separately

Unread post by gmanucci »

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
Major
Major
Posts: 169
Joined: Tue Sep 09, 2014 5:45 pm
Answers: 6
TopSolid Module: TopSolid'Steel
TopSolid Version: 7.14

Re: [TS6] Get shapes separately

Unread post by JuP »

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: 6.26

Re: [TS6] Get shapes separately

Unread post by gmanucci »

Hey!

Yes, they have ):
User avatar
JuP
Major
Major
Posts: 169
Joined: Tue Sep 09, 2014 5:45 pm
Answers: 6
TopSolid Module: TopSolid'Steel
TopSolid Version: 7.14

Re: [TS6] Get shapes separately

Unread post by JuP »

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: 6.26

Re: [TS6] Get shapes separately

Unread post 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,
User avatar
JuP
Major
Major
Posts: 169
Joined: Tue Sep 09, 2014 5:45 pm
Answers: 6
TopSolid Module: TopSolid'Steel
TopSolid Version: 7.14

Re: [TS6] Get shapes separately

Unread post 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

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