Get Part Data

Hi @zachri.jensen
Is it possible to add Part.PartData to Camber in the new version?
For now I can only see PressurePart.PartData.

I will add it to the list, although there is no timeline for the next release.

2 Likes

Thank you @zachri.jensen for the reply. I managed to get the PartData for the pipes with Python but I was disappointed because I wanted to get all the properties under geometry also but I could not find an Enumeration or anything similar in the API for me iterate over those properties. I was only able to find PartdData which returns “as it says” the PartData only. For now I guess it is best to manually handpick which properties I need from other groups.

If you know how to get the other properties under Geometry similar to getting PartData, a hint would be much appreciated!

What do you mean by this?

I mean other properties which don’t fall under Part Data. For example the data (properties) which fall under Geometry or another group. I know I can individually get every value but i was wondering if it is possible to retrieve everything related to the pipe (part) and not only part data using the API.

Hi @mzjensen, Where can we get the pressure pipe minimum and maximum cover in dynamo node


check this PE options

I want pressure PressurePipe minimum and maximum cover as Dynamo node or Python script to extract the data

Trying with any python code
To get maximum cover property

https://help.autodesk.com/view/CIV3D/2025/ENU/?guid=d9ef7336-e115-05f8-809f-bf47d8476956

Thanks for response. can you help me how to insert the code in the python script

@Manrajan.Kalimuthu1
try wiyh Ironpython 2.7

import sys
import clr

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
clr.AddReference('AeccPressurePipesMgd')
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

from System.Collections.Generic import Dictionary

adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument

from Autodesk.DesignScript.Geometry import *


def get_sample_line_info(sampleLines):
	
	global adoc
	global cdoc
	
	output = []
	

	if not sampleLines:
		return
	
	if not isinstance(sampleLines, list):
		sampleLines = [sampleLines]

	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
				for sampleLine in sampleLines:
					vals = []
					
					sampleLineId = sampleLine.InternalObjectId
					obj = t.GetObject(sampleLineId, OpenMode.ForRead)
					
					output.append( [obj.MaximumCover  , obj.MinimumCover   ])
					
					#if isinstance(obj, SampleLine):

						#output.append(obj)
						
				t.Commit()
	return output 		

OUT = get_sample_line_info(IN[0])

1 Like

There are some warning on the script while we take from pressure pipe list

receipt notes As I did
It won’t work like you did

It is working through select objects method. But, I want value from the PressurePipe lists. Could you able modify the script as per my requirement.

impossible

I got some solution in the python script

import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
clr.AddReference('AeccPressurePipesMgd')

# Import references from AutoCAD
from Autodesk.AutoCAD.ApplicationServices import Application
from Autodesk.AutoCAD.DatabaseServices import Transaction, OpenMode

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import CivilApplication
from Autodesk.Civil.DatabaseServices import PressurePipe

adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument

def get_minimum_cover(pressure_pipes):
    """
    Retrieves the minimum cover value for a list of PressurePipe objects.

    Args:
        pressure_pipes: A list of PressurePipe objects.

    Returns:
        list: A list of minimum cover values for each PressurePipe.
    """
    try:
        # Initialize the output list
        output = []

        # Ensure pressure_pipes is a list (if Dynamo sends a single object, convert it to a list)
        if not isinstance(pressure_pipes, list):
            pressure_pipes = [pressure_pipes]

        # Lock the AutoCAD document
        with adoc.LockDocument():
            db = adoc.Database
            with db.TransactionManager.StartTransaction() as t:
                for pipe in pressure_pipes:
                    pipe_id = None  # Initialize pipe_id
                    try:
                        # Get the PressurePipe object's ObjectId
                        pipe_id = pipe.InternalObjectId
                        # Get the PressurePipe object
                        obj = t.GetObject(pipe_id, OpenMode.ForRead)
                        # Check if the object is a PressurePipe
                        if isinstance(obj, PressurePipe):
                            # Append the minimum cover value to the output list
                            output.append(obj.MinimumCover)
                        else:
                            output.append("Object with ID {} is not a PressurePipe".format(pipe_id))
                    except Exception as obj_e:
                        if pipe_id is not None:
                            output.append("Failed to process object with ID {}: {}".format(pipe_id, str(obj_e)))
                        else:
                            output.append("Failed to process object: {}".format(str(obj_e)))

                t.Commit()

        return output

    except Exception as e:
        return ["General error: {}".format(str(e))]

# Assuming IN[0] is a list or single PressurePipe object from Dynamo
pressure_pipes = IN[0]  # IN[0] should be a list or single PressurePipe object
print("Input pressure pipes: {}".format(pressure_pipes))
minimum_cover_result = get_minimum_cover(pressure_pipes)
print("Minimum cover result: {}".format(minimum_cover_result))

OUT = minimum_cover_result

1 Like