Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wall thickness of Pipe in PartsList

5 REPLIES 5
Reply
Message 1 of 6
Jeff_M
468 Views, 5 Replies

Wall thickness of Pipe in PartsList

Is this property obtainable? How? .NET preferred, COM acceptable. Using c#.

 

CivilDocument civdoc = CivilApplication.ActiveDocument;
ObjectIdCollection ntwrkIds = civdoc.GetPipeNetworkIds();
Network m_ntwrk = (Network)ntwrkIds[0].GetObject(OpenMode.ForRead);
PartsList plist = (PartsList)m_ntwrk.PartsListId.GetObject(OpenMode.ForRead);
ObjectIdCollection partFamilies = plist.GetPartFamilyIdsByDomain(parttype);
PartFamily fam = (PartFamily)partFamilies[0].GetObject(OpenMode.ForRead);
PartSize ps = (PartSize)fam[0].GetObject(OpenMode.ForRead);
//now what????

 

Jeff_M, also a frequent Swamper
EESignature
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Jeff_M

Hi Jeff,

 

WallThickness Property is exposed for Pipe in .NET.

 

WallThickness Property -> Gets the wall thickness for this structure, measured from the inside edge of the structure to the outside edge of the structure.

** This property is meaningful only for junction structures if the part is a structure.

 

Am I missing anything here to understand the issue ?

 

Thanks,

Partha

Message 3 of 6
Jeff_M
in reply to: Anonymous

Partha, O can get the Wallthickness of a Pipe AFTER it is added to a Network. I'd like to get the WallThickness from the PartsList so I can determine which pipe can be used, based on user input criteria, prior to adding it to the Network. Right now I have it working by adding the pipe, checking the the height, verifying the part fits correctly, and swapping it out if not. This seems inefficient since the partslist has the information, I just don't see how to access it.
Jeff_M, also a frequent Swamper
EESignature
Message 4 of 6

It's not a direct call to a property, since the container is a generic one. You've got to get the SizeDataRecord property and then get its contents, or the content type you want. 

 

PartSize partSize = (PartSize)objId.GetObject(OpenMode.ForRead);
partSize.SizeDataRecord.GetDataFieldBy(PartContextType.WallThickness, 0);

 

The above example gets the Pipe Wall Thickness, which is what you want. But it's also has an index, so I think it would indicate that the part could have more than one pipe thickness. Although I think that would be the outlier case. You can also go through the entire list and choose which one to use.

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 5 of 6

Thanks, Christopher. I guess I'm being dense because I got that far, I can get the wall thickness of A partsize, but how to get a specific one? I will post some sample code that doesn't do what I thought it should as soon as I ressurect it from the "stuff that doesn't work" folder.

 

IIRC, I created a list of the available sizes using the names. The user selects the part they want to use, I then try to get the wall thickness for that selected size, based on the name.

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 6

In using this code I'm seeing it going through each part in the parts list. 

 

            PartFamilyItem pipeFamilyItem = (PartFamilyItem)cb_PipePartFamily.SelectedItem;

            for (int i = 0; i < pipeFamilyItem.PartFamily.PartSizeCount; i++)
            {
                ObjectId objId = pipeFamilyItem.PartFamily[i];
                PartSize partSize = (PartSize)objId.GetObject(OpenMode.ForRead);
                foreach (var item in partSize.SizeDataRecord.GetAllDataFields())
                {
                    try
                    {
                        string test = item.ContextString + Environment.NewLine +
                            item.DataType.ToString() + Environment.NewLine +
                            item.Description + Environment.NewLine +
                            item.Index.ToString() + Environment.NewLine +
                            item.IsFromList.ToString() + Environment.NewLine +
                            item.IsFromRange.ToString() + Environment.NewLine +
                            item.IsReadOnly.ToString() + Environment.NewLine +
                            item.Name + Environment.NewLine +
                            item.Units.ToString() + Environment.NewLine +
                            item.Value.ToString() + Environment.NewLine +
                            item.ValueList.ToString() + Environment.NewLine +
                            item.ValueRange.ToString();
                    }
                    catch (Exception)
                    {

                    }

                }

                PartSizeItem sizeItem = new PartSizeItem(partSize);
                cb_PipeSize.Items.Add(sizeItem);

 The code doesn't like one of the ToString() on one of the items, but watching the item in the Watch Viewer I'm seeing it going through each part size with a distinct pipe size and information. The PartSizeItem is just an object I'm using to put in the combo box. If I wanted to show the user the diameter and the wall thickness I'd use something like this:

 

public override string ToString()
            {
                try
                {
                    return m_Size.Name + " " + PartSize.SizeDataRecord.GetDataFieldBy(PartContextType.WallThickness);
                }
                catch (Exception)
                {

                    return m_Size.Name;
                }
                
            }

 The catch is just to make sure the wall thickness property is present. 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report