Revit split line function in Dynamo

Hi guys,

I am trying to split pipes that the joint appears. The only problem is u need the "splitLine"function from revit. Has anyone come across this node ?

Hope u guys can help me,
Verdi

I don’t believe this exists - if it does it’s a custom node in a package I don’t have much experience with. Instead, try this:

  1. Find the line in Dynamo
  2. Find the intersecting point.
  3. Split the line at that point - you should now have two lines in Dynamo.
  4. Set the location of the pipe to the first line in the list.
  5. Create a new pipe along the second line.

Several example threads exist on this, but I prefer this one: Split Geometry At a given length - #4

Goed idee, but I have already tried this and it does not seem to work.

I am using piping in Revit. When u use the command split line in Revit , the joint where u split line automatically appears. When u place a pipe on a line…via dynamo and then another pipe (same type) on a connected line, it automatically connects the pipes and they become one.

You can use the LookupcommandID function to replicate the function Split Element but there is not much interest in doing it with Dynamo.

#@nathan.chapman
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
import Autodesk
from Autodesk.Revit.UI import RevitCommandId
from Autodesk.Revit.UI import UIApplication
from Autodesk.Revit.UI import ExternalCommandData
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication

RunIt = IN[0] #Delay execution until selection set etc. has been made

if RunIt ==  True:
	CmndID = RevitCommandId.LookupCommandId('ID_SPLIT')
	CmId = CmndID.Id
	uiapp.PostCommand(CmndID)
	errorReport = 'Success'
else:
	errorReport = 'Set IN[0] to true to run'

#Assign your output to the OUT variable
OUT = errorReport

I only know a little bit of scripting in Dynamo. So I do not understand what u mean with this post.

Can u explain it a little to someone who works with pre-defined nodes ?

Run the .dyn file and you will understand what I mean.

Split Element.dyn (2.3 KB)

Perhaps add a step 4a to add a connector to the end of the first pipe? I know the command adds the two pieces (the connector and the pipe) in a sequence but I cannot remember what the order is.

I ran the script but do not know how to use the node further to tell the node where to split the element.

The only thing I see the script doing is opening the split element command. As I cannot edit the python-code (lack of python- knowledge) , pressing "SL"in Revit is faster. So I do not really see the use of the script.

Can the script be build so that this is the start and after this u give commands (location) where to cut on a given element?

1 Like

Yep I know. The script can only be useful in very special cases.

@jacob.small’s workflow should suit your needs.