Pick new host rebar

pick new host rebar?

Hello! Here is the anwer:


Can you help me creat node?

It depends on how much help you need.

You need two inputs, let’s name them rebarElement and hostElement

Then between transaction start and commit write something like this:

rebarElement.SetHostId(doc, hostElement.Id)

1 Like

Can you help me write this node?

If you need help to review something wrong in your code, you will find here how to paste what you have done so far:

I tried to do the same thing as pvhuyg and it seems that my Dynamo script can’t access the attribute SetHostID
It also couldn’t get the ID of the desired host element with “hostElement.id”

Is there anything im missing out in the Code?

Edit/Update 1: i found out the element im trying to feed into the Python Script is a RebarInSystem class not the RebarClass. Unfortunately the RebarInSystem class does not provide a SetHostId Method. Still trying to figure out to make it work :confused:

# Phython-UnterstĂĽtzung aktivieren und DesignScript-Bibliothek laden
import clr
import Autodesk
from Autodesk.Revit.DB import *
import System

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Die Eingaben fĂĽr diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
rebarElement = UnwrapElement(IN[0])
hostElement = UnwrapElement(IN[1])

# Code unterhalb dieser Linie platzieren

if IN[2]==True:
	OUT = hostElement
	OUT = "not run"
# Weisen Sie Ihre Ausgabe der OUT-Variablen zu.

Try rebarElement.SetHostId(doc, hostElement) instead.

1 Like

Thank you @MartinSpence that solved my Problem

Excellent :ok_hand: