Set Grid Extents and Bubbles

Hello Dynamo Friends :slight_smile:

Thanks to @c.poupin , @Nick_Boyts and @Mark.Ackerley i have a python code that sets the grid extents and i have a python code that sets the grid bubbles. Everything works great, but combining it in one dynamo graph does not work. After days of investigating I´m out of ideas.

First of all, the python code that sets the bubbles activates the left bubbles and if the grid is vertical it activates the upper bubbles. This works no matter in which direction the grids have been drawn.

Note that running the graph over and over alway gives the same result.

But now in the full graph of setting the extents and bubbles it does not work, it´s going insane. You can see that the bubbles do whatever they want and everytime i run the graph again they will change.

ezgif.com-gif-maker

My guess is that the “Set Grids to Cropbox” code changes the grid, in particular it changes what the end and startpoint is?!

what leads me to other questions:
When i draw a grid from left to right, the start point of the grid curve will be the one with greater x value. This is somehow reversed?!

So what even is DatumEnd0 and DatumEnd1, it is all confusing to me.

Dyn attached! Happy about any help :slight_smile:
Set Grid and Bubbles.dyn (106.1 KB)

1 Like

If I run just the Grid to Cropbox python node the grids all get realigned to be drawn in the same direction. Is that what you’re expecting? It may be that you’re pulling the directional data before the crop changes have been committed to the project and therefore you’re doubling up on managing certain grids. You could try adding a Transaction node, but I’m guessing you might be able to just rewrite your Grid to Cropbox code to draw in the opposite directions (it gave me grid heads at bottom and right in my example).

1 Like

Hello Nick :slight_smile:

Lets have a look whats happening to two grids that are drawn in different directions:

And at a second run:

We can see that the startpoint and endpoint of the curve don´t change. but the results do. This makes no sense to me. So the question is if the curve start/end are even equal to the grid start/end.

Transactions, tried that already in all possible way…

1 Like

very strange, this code should not set the bubbles, only the extents!
Or do you mean the other python code? Already tried that multiple times. Doesn´t work…the graph behaves random at every run…
The standalone “set bubbles” is in fact working…

In my testing, the Curve start was always at the bubble head (Grid end in my case).

I´m using curve start and end for my calculations.
It seems that curve start and end do not change.

But Grid/Datum end does change, so i think the solution to my problem would be to not use the curve for calculations but the Grid/Datum. So i have to get the coordinates of DatumEnd0 and DatumEnd1 and use them for my calculations.

That’s what I was going to suggest.

Here’s where I’m using just the Grid to Cropbox node.
Revit_2022-02-24_15-57-14

As for the curve direction, I think the curve is always drawn in the positive direction and that’s why they don’t change. Keep in mind the DatumPlane is not the same as the Grid. The Grid is only a representation of the DatumPlane and why there are “discrepancies” between the two. I think using DatumEnd will be better but you will still need to confirm left/right or top/bottom in terms of location.

1 Like

i managed to test which end is end0 and end1 by using IsBubbleVisibleInView.

It tells me whats going on when running the “grid to cropbox” code.

The same bubble is turned off, that means the whole grid is fliped!
This is also the proof that End0 is the End point of the grid curve. So grid curve Start/End and End0/End1 are not corresponding.

Thats at least some information. Will take me a few days to research how to get the points/coordinates of datum ends…


doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
views = UnwrapElement(IN[0])
firstview = views[0]
elements = list()

TransactionManager.Instance.EnsureInTransaction(doc)

coll = FilteredElementCollector(doc, firstview.Id)
filt = ElementCategoryFilter(BuiltInCategory.OST_Grids)
grids = coll.WherePasses(filt).ToElements()
firstgrid = grids[0]

x = firstgrid.IsBubbleVisibleInView(DatumEnds.End0, firstview)

OUT = x

I found the solution to this problem here:

I have to transform the curve ends to coordinate space of view.

XYZ[] EP = new XYZ[] 
				Tx.Inverse.OfPoint(crv.GetEndPoint(0)),
				Tx.Inverse.OfPoint(crv.GetEndPoint(1))

Will try my luck on getting this to work in python.

Seems like that i got it:

Point = UnwrapElement(IN[1])

Tx = Transform.Identity
Tx.BasisX = view.RightDirection
Tx.BasisY = view.UpDirection
Tx.BasisZ = XYZ.BasisZ

TransPoint = Tx.Inverse.OfPoint(Point)

OUT = TransPoint

I´m going to try if this points are any help to my problem…

1 Like

I´m now using the transformed endpoints for my bubble calculations, wohoo!
The resullt is the same as before with the curve endpoints, the bubble will be at the wrong end when the grid gets fliped :confused:

I think i did exactly what was suggested in the autodesk board…am i doing something wrong?
My transformation obviousely doesnt make any difference to the points…

view = views[0]
grid = grids[0]
Point = UnwrapElement(IN[1])

Tx = Transform.Identity
Tx.BasisX = view.RightDirection
Tx.BasisY = view.UpDirection
Tx.BasisZ = XYZ.BasisZ

TransPoint = Tx.Inverse.OfPoint(Point)
xvalue = TransPoint.X

OUT = xvalue

I found a solution that works.
Instead of writing code to find End0 and End1, i just looked if i can take any values from the “Grid to Cropbox” code. I can!

I´m now taking points of the newGLine, they are corresponding with DatumEnds :slight_smile:

Now there is only one problem left, i can only output the points of the first gridline, how can i output a list of points from all the gridlines?

startpointXYZ = newGLine.GetEndPoint(0)
endpointXYZ = newGLine.GetEndPoint(1)
startpoint = startpointXYZ.ToPoint()
endpoint = endpointXYZ.ToPoint()

OUT =  lstInputViews, startpoint, endpoint

image

full code:

for activView in lstInputViews:

	#
	activView.CropBoxVisible = True
	doc.Regenerate()
	#
	cropBox = activView.CropBox 

	fecGrids = FilteredElementCollector(doc, activView.Id).OfClass(DatumPlane).ToElements()
	cutOffset = fecGrids[0].GetCurvesInView(DatumExtentType.ViewSpecific, activView)[0].GetEndPoint(0).Z
	fecGrids = [x for x in fecGrids if isinstance(x, DB.Grid)]

	outLst = []
	shpManager = activView.GetCropRegionShapeManager()
	boundLines = shpManager.GetCropShape()[0]


	if activView.ViewDirection.IsAlmostEqualTo(XYZ(0,0,1)):
		# get Current Elevation of boundLines
		currentZ = list(boundLines)[0].GetEndPoint(0).Z
		# transform boundLines CurveLoop
		tf = Transform.CreateTranslation( XYZ(0,0, cutOffset - currentZ))
		boundLines = CurveLoop.CreateViaTransform(boundLines, tf)
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
	else:
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
TransactionManager.Instance.TransactionTaskDone()

startpointXYZ = newGLine.GetEndPoint(0)
endpointXYZ = newGLine.GetEndPoint(1)
startpoint = startpointXYZ.ToPoint()
endpoint = endpointXYZ.ToPoint()

OUT =  lstInputViews, startpoint, endpoint

First step, i have to make a list out of the newGLines somehow :thinking: How can i do that?
Then i would loop through that list to get the points and output the lists of points…

Something like that?!

	outLstEnd = []
	outLstStart = []

for newGLine in fecGrids

	startpointXYZ = newGLine.GetEndPoint(0)
	endpointXYZ = newGLine.GetEndPoint(1)
	startpoint = startpointXYZ.ToPoint()
	endpoint = endpointXYZ.ToPoint()
	
	outLstEnd.append(endpoint)
	outLstStart.append(startpoint)

OUT =  lstInputViews, outLstEnd, outLstStart

Script is now working by using the new gridline points to set the grid bubbles :slight_smile:

Thanks for the help @Nick_Boyts

import clr
import System
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DSGeo
from Autodesk.DesignScript.Geometry import *

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)


clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)


def createDatumLine(boundLines, grid):
	gridLine = None
	curveG = grid.Curve#.ToProtoType()
	vectGrid = curveG.Direction
	lstPtToLine = []
	for lineBound in boundLines:
		rayc = DB.Line.CreateUnbound(XYZ(curveG.Origin.X, curveG.Origin.Y, lineBound.GetEndPoint(0).Z) , vectGrid)
		outInterR = clr.Reference[IntersectionResultArray]()
		result = rayc.Intersect(lineBound, outInterR)
		print(result)
		if result == SetComparisonResult.Overlap:
			interResult = outInterR.Value
			lstPtToLine.append(interResult[0].XYZPoint)
	print(lstPtToLine)
	if len(lstPtToLine) == 2:
		P1 = lstPtToLine[0].ToPoint()
		P2 = lstPtToLine[1].ToPoint()
		TransXYZ1 = Geometry.Translate(P1 ,0,0,0)
		TransXYZ2 = Geometry.Translate(P2 ,0,0,0)
		TransPoint1 = TransXYZ1.ToXyz()
		TransPoint2 = TransXYZ2.ToXyz()
		gridLine = Autodesk.Revit.DB.Line.CreateBound(TransPoint1, TransPoint2)
	return gridLine
	
activView = UnwrapElement(IN[0])
lstInputViews = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)

for activView in lstInputViews:

	#
	activView.CropBoxVisible = True
	doc.Regenerate()
	#
	cropBox = activView.CropBox 

	fecGrids = FilteredElementCollector(doc, activView.Id).OfClass(DatumPlane).ToElements()
	cutOffset = fecGrids[0].GetCurvesInView(DatumExtentType.ViewSpecific, activView)[0].GetEndPoint(0).Z
	fecGrids = [x for x in fecGrids if isinstance(x, DB.Grid)]

	outLst = []
	newGLineList = []
	shpManager = activView.GetCropRegionShapeManager()
	boundLines = shpManager.GetCropShape()[0]


	if activView.ViewDirection.IsAlmostEqualTo(XYZ(0,0,1)):
		# get Current Elevation of boundLines
		currentZ = list(boundLines)[0].GetEndPoint(0).Z
		# transform boundLines CurveLoop
		tf = Transform.CreateTranslation( XYZ(0,0, cutOffset - currentZ))
		boundLines = CurveLoop.CreateViaTransform(boundLines, tf)
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			newGLineList.append(newGLine) 
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
	else:
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			newGLineList.append(newGLine)
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
TransactionManager.Instance.TransactionTaskDone()

startpointList = []
endpointList = []

for newGLine in newGLineList:
	
	startpointXYZ = newGLine.GetEndPoint(0)
	endpointXYZ = newGLine.GetEndPoint(1)
	startpoint = startpointXYZ.ToPoint()
	endpoint = endpointXYZ.ToPoint()
	startpointList.append(startpoint)
	endpointList.append(endpoint)

OUT =  lstInputViews, startpointList, endpointList
3 Likes

Hello @c.poupin :slight_smile:

By adding an output of grid angle to your code i could make the process of setting the bubbles much more efficient :smiley:

This is now the exact result i want:

ezgif.com-gif-maker

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices

from RevitServices.Persistence import *
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

if isinstance(IN[1], list):
	gridList = UnwrapElement(IN[0])
	viewList = UnwrapElement(IN[1])
	angleList = UnwrapElement(IN[2])
else:
	gridList = [UnwrapElement(IN[0])]
	viewList = [UnwrapElement(IN[1])]
	angleList = [UnwrapElement(IN[2])]
	
TransactionManager.Instance.EnsureInTransaction(doc)

for grids, angles, view in zip(gridList, angleList, viewList):

	for grid, angle in zip(grids, angles):
		if 121< angle <300:	
			grid.ShowBubbleInView(DatumEnds.End1,view) 
			grid.HideBubbleInView(DatumEnds.End0,view)
		else:
			grid.ShowBubbleInView(DatumEnds.End0,view)
			grid.HideBubbleInView(DatumEnds.End1,view)
	
TransactionManager.Instance.TransactionTaskDone()

doc.Regenerate()

OUT = viewList
import clr
import math
import System
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DSGeo
from Autodesk.DesignScript.Geometry import *

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

def createDatumLine(boundLines, grid):
	gridLine = None
	curveG = grid.Curve#.ToProtoType()
	vectGrid = curveG.Direction
	lstPtToLine = []
	for lineBound in boundLines:
		rayc = DB.Line.CreateUnbound(XYZ(curveG.Origin.X, curveG.Origin.Y, lineBound.GetEndPoint(0).Z) , vectGrid)
		outInterR = clr.Reference[IntersectionResultArray]()
		result = rayc.Intersect(lineBound, outInterR)
		print(result)
		if result == SetComparisonResult.Overlap:
			interResult = outInterR.Value
			lstPtToLine.append(interResult[0].XYZPoint)
	print(lstPtToLine)
	if len(lstPtToLine) == 2:
		P1 = lstPtToLine[0].ToPoint()
		P2 = lstPtToLine[1].ToPoint()
		TransXYZ1 = Geometry.Translate(P1 ,0,0,0)
		TransXYZ2 = Geometry.Translate(P2 ,0,0,0)
		TransPoint1 = TransXYZ1.ToXyz()
		TransPoint2 = TransXYZ2.ToXyz()
		gridLine = Autodesk.Revit.DB.Line.CreateBound(TransPoint1, TransPoint2)
	return gridLine
	
activView = UnwrapElement(IN[0])
lstInputViews = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)

for activView in lstInputViews:

	#
	activView.CropBoxVisible = True
	doc.Regenerate()
	#
	cropBox = activView.CropBox 

	fecGrids = FilteredElementCollector(doc, activView.Id).OfClass(DatumPlane).ToElements()
	cutOffset = fecGrids[0].GetCurvesInView(DatumExtentType.ViewSpecific, activView)[0].GetEndPoint(0).Z
	fecGrids = [x for x in fecGrids if isinstance(x, DB.Grid)]

	outLst = []
	newGLineList = []
	shpManager = activView.GetCropRegionShapeManager()
	boundLines = shpManager.GetCropShape()[0]


	if activView.ViewDirection.IsAlmostEqualTo(XYZ(0,0,1)):
		# get Current Elevation of boundLines
		currentZ = list(boundLines)[0].GetEndPoint(0).Z
		# transform boundLines CurveLoop
		tf = Transform.CreateTranslation( XYZ(0,0, cutOffset - currentZ))
		boundLines = CurveLoop.CreateViaTransform(boundLines, tf)
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			newGLineList.append(newGLine) 
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
	else:
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			newGLineList.append(newGLine)
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
TransactionManager.Instance.TransactionTaskDone()

startpointList = []
endpointList = []
rotationAngleList = []

for newGLine in newGLineList:
	
	startpointXYZ = newGLine.GetEndPoint(0)
	endpointXYZ = newGLine.GetEndPoint(1)
	startpoint = startpointXYZ.ToPoint()
	endpoint = endpointXYZ.ToPoint()
	startpointList.append(startpoint)
	endpointList.append(endpoint)
	
	vector = newGLine.Direction
	rotationAngle = abs(math.degrees(vector.AngleOnPlaneTo(XYZ.BasisX, XYZ.BasisZ)))
	rotationAngleList.append(rotationAngle)

OUT =  lstInputViews, startpointList, endpointList, rotationAngleList
4 Likes

nice :ok_hand: :+1:

1 Like

Classic, first test in real project and it does not work :smiley:

Getting the right angle does not work if the view has a rotation.

I can not use AngleOnPlaneTo(XYZ.BasisX, XYZ.BasisZ) like that.

rotationAngle = abs(math.degrees(vector.AngleOnPlaneTo(XYZ.BasisX, XYZ.BasisZ)))

I somehow have to add view.rightdirection to define the plane.

edit:

rotationAngle = abs(math.degrees(vector.AngleOnPlaneTo(activView.RightDirection, XYZ.BasisZ)))

Seems to work like that!

Code works for multiple views but my output only works for 1 view.
After hours of trying i ask for help again.

I don´t know how to deal with the sublists:

Working for only one view:

startpointList = []
endpointList = []
rotationAngleList = []

for newGLine in newGLineList:

	startpointXYZ = newGLine.GetEndPoint(0)
	endpointXYZ = newGLine.GetEndPoint(1)
	startpoint = startpointXYZ.ToPoint()
	endpoint = endpointXYZ.ToPoint()
	startpointList.append(startpoint)
	endpointList.append(endpoint)
	
	vector = newGLine.Direction
	rotationAngle = abs(math.degrees(vector.AngleOnPlaneTo(activView.RightDirection, XYZ.BasisZ)))
	rotationAngleList.append(rotationAngle)

OUT =  lstInputViews, rotationAngleList

One of my failed attempts:

startpointList = []
endpointList = []
rotationAngleList = []

for newGLines in newGLineList:
	for newGLine in newGLines:

I got many differenht lists, for example sublists with too many items…but i can´t get the result i want :confused: Maybe i have to use this mysteriouse [x for x in y] thing i don´t understand.
I don´t think i have to zip lists together in this case?

Happy about any help :slight_smile: thanks!

edit:
The problem has to be something even before, because newGLineList ist also only a list for 1 view.

image

Full code:

import clr
import math
import System
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DSGeo
from Autodesk.DesignScript.Geometry import *

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

def createDatumLine(boundLines, grid):
	gridLine = None
	curveG = grid.Curve#.ToProtoType()
	vectGrid = curveG.Direction
	lstPtToLine = []
	for lineBound in boundLines:
		rayc = DB.Line.CreateUnbound(XYZ(curveG.Origin.X, curveG.Origin.Y, lineBound.GetEndPoint(0).Z) , vectGrid)
		outInterR = clr.Reference[IntersectionResultArray]()
		result = rayc.Intersect(lineBound, outInterR)
		print(result)
		if result == SetComparisonResult.Overlap:
			interResult = outInterR.Value
			lstPtToLine.append(interResult[0].XYZPoint)
	print(lstPtToLine)
	if len(lstPtToLine) == 2:
		P1 = lstPtToLine[0].ToPoint()
		P2 = lstPtToLine[1].ToPoint()
		TransXYZ1 = Geometry.Translate(P1 ,0,0,0)
		TransXYZ2 = Geometry.Translate(P2 ,0,0,0)
		TransPoint1 = TransXYZ1.ToXyz()
		TransPoint2 = TransXYZ2.ToXyz()
		gridLine = Autodesk.Revit.DB.Line.CreateBound(TransPoint1, TransPoint2)
	return gridLine
	
activView = UnwrapElement(IN[0])
lstInputViews = UnwrapElement(IN[0])
TransactionManager.Instance.EnsureInTransaction(doc)

for activView in lstInputViews:

	#
	activView.CropBoxVisible = True
	doc.Regenerate()
	#
	cropBox = activView.CropBox 

	fecGrids = FilteredElementCollector(doc, activView.Id).OfClass(DatumPlane).ToElements()
	cutOffset = fecGrids[0].GetCurvesInView(DatumExtentType.ViewSpecific, activView)[0].GetEndPoint(0).Z
	fecGrids = [x for x in fecGrids if isinstance(x, DB.Grid)]

	outLst = []
	newGLineList = []
	shpManager = activView.GetCropRegionShapeManager()
	boundLines = shpManager.GetCropShape()[0]


	if activView.ViewDirection.IsAlmostEqualTo(XYZ(0,0,1)):
		# get Current Elevation of boundLines
		currentZ = list(boundLines)[0].GetEndPoint(0).Z
		# transform boundLines CurveLoop
		tf = Transform.CreateTranslation( XYZ(0,0, cutOffset - currentZ))
		boundLines = CurveLoop.CreateViaTransform(boundLines, tf)
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			newGLineList.append(newGLine) 
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
	else:
		for grid in fecGrids:
			outLst.append(grid.Curve.ToProtoType())
			newGLine = createDatumLine(boundLines, grid)
			newGLineList.append(newGLine)
			if newGLine is not None:
				grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)
			
TransactionManager.Instance.TransactionTaskDone()

startpointList = []
endpointList = []
rotationAngleList = []

for newGLine in newGLineList:

	startpointXYZ = newGLine.GetEndPoint(0)
	endpointXYZ = newGLine.GetEndPoint(1)
	startpoint = startpointXYZ.ToPoint()
	endpoint = endpointXYZ.ToPoint()
	startpointList.append(startpoint)
	endpointList.append(endpoint)
	
	vector = newGLine.Direction
	rotationAngle = abs(math.degrees(vector.AngleOnPlaneTo(activView.RightDirection, XYZ.BasisZ)))
	rotationAngleList.append(rotationAngle)

OUT =  newGLineList

Another failed attemt that gives me a weird long list insted of sublists:

startpointList = []
endpointList = []
rotationAngleList = []

for activView in lstInputViews:
	for newGLine in newGLineList:

		startpointXYZ = newGLine.GetEndPoint(0)
		endpointXYZ = newGLine.GetEndPoint(1)
		startpoint = startpointXYZ.ToPoint()
		endpoint = endpointXYZ.ToPoint()
		startpointList.append(startpoint)
		endpointList.append(endpoint)
	
		vector = newGLine.Direction
		rotationAngle = abs(math.degrees(vector.AngleOnPlaneTo(activView.RightDirection, XYZ.BasisZ)))
		rotationAngleList.append(rotationAngle)

OUT =  rotationAngleList

1 Like