Conduit Fitting re-assign Level

Conduit Fitting re-assign Level

studio-a-int
Advocate Advocate
332 Views
3 Replies
Message 1 of 4

Conduit Fitting re-assign Level

studio-a-int
Advocate
Advocate

I'm testing a static code (Python) to re-assign level to Conduits + Conduit Fittings that were placed by BIM operators to a Level that we want to be changed.

 

When I run to code on a Conduit Fitting that is not connected to other Conduits, everything works fine (Conduit Fitting is maintaining same z)

 

Once I run the code on a Conduit Fitting that has Conduits attached to it, they move up (z changes).

 

Below is the Python code:

 

# CONDUIT FITTING TO TEST Id = 9803491
EL_ID = ElementId(9803491)
# SELECT THE CONDUIT FITTING TO TEST
MY_EL = doc.GetElement(EL_ID)

# B_FOOTING = CURRENT REFERENCE LEVEL FOR THE CONDUIT+CONDUIT FITTINGS
# FIRST_FLOOR = LEVEL WHERE I WANT THE CONDUIT+CONDUIT FITTINGS RE-ASSIGNED

# LEVEL ID WHERE I WANT MY CONDUIT FITTING TO BE SET
FIRST_FLOOR_LEVEL_ID = 355

t = Transaction(doc, 'SET LEVEL')
t.Start()
OFF_SET =  - FIRST_FLOOR_LEVEL_ELEV + B_FOOTING_LEVEL_ELEV + i.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).AsDouble()
MY_EL.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).Set(OFF_SET)     
MY_EL.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM).Set(ElementId(355))
doc.Regenerate()
t.Commit()

 

Help greatly appreciated.

Thank you.

0 Likes
333 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Studio A,

 

Thank you for your query.

 

What happens when you perform the same operation manually in the user interface?

 

In general, the Revit API functionality will [pretty closely replicate the UI functionality with both its desired and possibly undesired features.

 

What happens if you disconnect the neighbouring conduits before executing the modification?

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

jeremytammik
Autodesk
Autodesk

Sorry, duplicated the answer due to network problems... and no possibility to delete the wrong answer here... please ignore.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 4 of 4

studio-a-int
Advocate
Advocate

Jeremy - thanks for your reply.

As I mentioned in my initial post, if the electrical conduit fitting is not connected to any conduits, the code run without issues (I did test it on one-at-a-time conduit fittings, not on a collection).

If the conduit fitting has conduits attached, after the cod is run, the fitting + connected conduits are changing the elevation. So might be because Revit is considering the entire run.

 

I'm looking more in detail to test couple scenarios.

 

thank you.

0 Likes