Set Curve of SectionLine

Hello Dynamo Friends :slight_smile:

I want to set the extents/markers of sectionlines.
As example I want to set it to the half of it´s length.
I can get the curve with @Alban_de_Chasteigner ´s Element Location Curve node.
But I´m struggling at setting an new curve to the sectionline:

Happy about any advice :slight_smile:

items = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]
curve = UnwrapElement(IN[1])


for item in items:
	doc=item.Document

	viewSection = doc.GetElement(ElementId(item.Id.IntegerValue + 1))
	newshape=viewSection.GetCropRegionShapeManager().SetCropShape(curve)

Hi!
Do you want to bring the section heads to the middle of their line?

Reading the error message, it looks like you’re passing it a curve, but you need a curve loop (silly but it allows the stepped sections).

Create a new curve loop, and append your curve and the error should be resolved. You may need to convert the curve to a Revit curve first though.

1 Like

Hello Jacob,

This gives me this error, Error creating an arc!

curve = UnwrapElement(IN[0])
loop=CurveLoop()
loop.Append(curve.ToRevitType())

Can you post a rvt and you dyn?

It looks like you might be passing a dynamo arc instead of a Revit one.

You are right that was just a problem with the curve.

Next error for SetCropShape:

Now I´m asking myselfe if this is even right to get the sectionview from the section line and set the cropshape to the sectionview…

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument
items = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]
curve = UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)
loop=CurveLoop()
loop.Append(curve.ToRevitType())
for item in items:
	doc=item.Document
	viewSection = doc.GetElement(ElementId(item.Id.IntegerValue + 1))
	newshape = viewSection.GetCropRegionShapeManager().SetCropShape(loop)

TransactionManager.Instance.TransactionTaskDone()

OUT = loop,viewSection

Looks like not… I’ll try and have a look later tonight, or sometime next week.

1 Like

CropShape needs a CurveLoop that contains at least 4 curves. And I don’t think that section line is editable. I had searched for an API-Method but I could not find.

1 Like

Thanks for your help.

Alban is writing about Section Markers in his Set.Location node:

loc = element.Location
if loc:	
##Section Marker and ReferenceElevationMarker(Doesn't work for ReferenceElevationMarker)
if ElementId(BuiltInCategory.OST_Viewers) == element.Category.Id :
	viewSection = doc.GetElement(ElementId(element.Id.IntegerValue + 1))
	loca = viewSection.Origin

ElementTransformUtils.MoveElement(doc,element.Id,location.ToRevitType()-loca)

So maybe the marker itselfe can be moved along the section line?
Or is this only about moving the whole sectionline?