Extracting Family Info

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

Moderators: remi77, jacs, Daniel

nikhilruikar
Private First Class
Private First Class
Posts: 18
Joined: Tue Sep 08, 2015 11:04 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.25

Extracting Family Info

Unread post by nikhilruikar »

Hi Team,

I have a TopSolid document that contains three families.
The API IFamilies.IsFamily() returns true.
The API IFamilies,GetCodes(DocumentId) return a List<string> which has 3 items containing the names of the 3 families.

Each family contains one distinct shape visible only in its particular family.
e.g.-
1.Family1: Only Circular shape visible.
2.Family2: Only Rectangular shape visible.
3.Family3: Only Triangular shape visible.

My aim is to get the families & then get the shapes in each family.
Are there any APIs that I can use for this purpose?
Thanks in advance.

Regards,
Nikhil
Last edited by nikhilruikar on Wed Oct 21, 2015 1:59 pm, edited 1 time in total.
Mark Oostveen
Chief
Chief
Posts: 107
Joined: Mon Mar 26, 2007 9:40 am
TopSolid Module: TopSolid'Cam
TopSolid Version: 6.26
Location: The netherlands
Contact:

Re: Extracting Family Info

Unread post by Mark Oostveen »

Hi,

Please explain the general gaol of you project. Maybe we can find a alternate solution to the question.

To use IFamilies.IsFamily([DocId of Family doc]) you somehouw retrieved the documentId of the family Document. Where and how did you get this?
The function IFamilies.GetCodes([DocId of Family doc]) returns the codes in the family document, not the code currently used in the assembly containing the family. So in my opinion you are not working with you overall assembly containing the families. You are investigating the family document.

So If you want to check which shape is in your overall assembly

I am not sure what you want with the shapes but can you do something like this?
My approach would be to create a bom templete. One of the colums would be the code of the Family. Than create the BOM on my overal document. Loop through the bom to find the BomRows where the Code column is not empy. Maybe you could put hte information of the shapes in the BOM aswell, than you have your info. To link, maybe make a unike column like part number in the BOM. Tahn get all the shapes of your assembly TopSolidHost.Assemlby.GetShapes() loop through the shapes to check for the part numbers...

Just my 2 cents.

Mark
nikhilruikar
Private First Class
Private First Class
Posts: 18
Joined: Tue Sep 08, 2015 11:04 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.25

Re: Extracting Family Info

Unread post by nikhilruikar »

Thanks for the reply Mark.
But I figured it out.

I was trying to access the family document. Now I am accessing the separate family specific documents from PDM directly.

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

Re: Extracting Family Info

Unread post by gmanucci »

u looking for this?

i've created this class shows you an list of string of the codes of an document id.

Code: Select all

Family FmFile = new Family(DocumentId);
MessageBox.Show(FmFile.Codes[0]);

Code: Select all

    public class Family 
    {
        DocumentId MainDocId;

        void Family(DocumentId DocId)
        {
            if(TopSolidHost.Families.IsFamily(DocId))
            {
                this.MainDocId = DocId;
            }
            else
            {
                throw new Exception("Arquivo não é Família.");
            }
        }

        public List<string> Codes
        {
            get
            {
                return TopSolidHost.Families.GetCodes(MainDocId);
            }
        }
    }
nikhilruikar
Private First Class
Private First Class
Posts: 18
Joined: Tue Sep 08, 2015 11:04 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.25

Re: Extracting Family Info

Unread post by nikhilruikar »

Thanks gmanucci.
The code above will give me the Main document & the family names.
I want to access the sub-family documents. I can do that now.

Thanks. Case Closed.
Last edited by nikhilruikar on Wed Oct 21, 2015 1:58 pm, edited 1 time in total.
gmanucci
Master Corporal
Master Corporal
Posts: 49
Joined: Tue Sep 29, 2015 2:48 pm
TopSolid Module: TopSolid'Cam
TopSolid Version: 6.26

Re: Extracting Family Info

Unread post by gmanucci »

U're welcome :D
Post Reply