API for Lookup Tables?

API for Lookup Tables?

psh.t
Contributor Contributor
2,218 Views
1 Reply
Message 1 of 2

API for Lookup Tables?

psh.t
Contributor
Contributor

Hello. Would you so kind to tell me if it's possible to get the access to Lookup Tables through API? I've sought for but found nothing. I ask you as there's a problem family that exports any Lookup Tables without names of columns, including either LookupTables that exist in this family or any other imported ones. Is there anybody to explain what it is caused by and to tell me how I can get the information about the names of the Lookup Tables?

Павел Тер-Микаэлян
email: psh.t@inbox.ru
Accepted solutions (1)
2,219 Views
1 Reply
Reply (1)
Message 2 of 2

MarryTookMyCoffe
Collaborator
Collaborator
Accepted solution

you  can have  access to a tables with

FamilySizeTableManager

 for exemple: I use to get some lenght like that:

   public double getLenght(double dn, double dn2, FamilySizeTable fST)
        {
            if(double.IsNaN(dn)&& double.IsNaN(dn2))
                throw new ArgumentNullException("dn or dn2 can't be a null or NaN");
            else
                if(fST == null)
                    throw new ArgumentNullException("fST can't be a null");

            FamilySizeTableColumn familySizeTableColumn_DN = fST.GetColumnHeader(1);
            FamilySizeTableColumn familySizeTableColumn_DN2 = fST.GetColumnHeader(2);
            FamilySizeTableColumn familySizeTableColumn_LENGHT = fST.GetColumnHeader(4);

            if (familySizeTableColumn_DN.Name == "DN" && familySizeTableColumn_DN2.Name == "DN2")
            {
                if (familySizeTableColumn_LENGHT.Name == "LENGHT")
                {
                    double Dn;
                    double Dn2;
                    
                    for (int i = 0; i < fST.NumberOfRows; i++)
                    {
                        //TaskDialog.Show("Error", fST.AsValueString(i, 1).Replace('.', ','));
                        Dn = Convert.ToDouble(fST.AsValueString(i, 1).Replace('.', ','));//1000/0.3048;
                        Dn2 = Convert.ToDouble(fST.AsValueString(i, 2).Replace('.', ','));// 1000 / 0.3048;

                        if (Math.Round(dn, 4) == Math.Round(Dn / 0.3048 / 1000, 4) &&  Math.Round(dn2 , 4) == Math.Round(Dn2 / 0.3048 / 1000, 4))
                        {
                            return Convert.ToDouble(fST.AsValueString(i, 4).Replace('.', ',')) /1000;
                        }
                        else
                        {
                            if (Math.Round(dn2, 4) == Math.Round(Dn / 0.3048 / 1000, 4) && Math.Round(dn, 4) == Math.Round(Dn2 / 0.3048 / 1000, 4))
                            {
                                return Convert.ToDouble(fST.AsValueString(i, 4).Replace('.', ',')) / 1000;
                            }
                        }
                    }


                    return 0;
                }
                else
                {
                    throw new AggregateException("problem with table,LENGHT schould be 4 column");
                }
            }
            else
            {
                throw new AggregateException("problem with table, DN schould be 1 column and DN2 schould be 2 column");
            }
        }

 

 

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug