Smooth Grid bubbles along croped view - disdance 0.00, how?


How to make this bubbles smooth on the line of a croped view via cropbox?

import clr
from Autodesk.DesignScript.Geometry import *

import Autodesk
from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

def createDatumLine(boundLines, grid):
	gridLine = None
	curveG = grid.Curve
	vectGrid = curveG.Direction 
	ptmid = curveG.Evaluate(0.5, True)
	lstPtToLine = []
	for lineBound in boundLines:
		interResult = lineBound.Project(ptmid)
		vectInterResult = Autodesk.Revit.DB.Line.CreateBound( ptmid , interResult.XYZPoint).Direction
		if vectInterResult.IsAlmostEqualTo(vectGrid, 0.1) or vectInterResult.IsAlmostEqualTo(vectGrid.Negate(), 0.1):

	if len(lstPtToLine) == 2:
		gridLine = Autodesk.Revit.DB.Line.CreateBound(lstPtToLine[0], lstPtToLine[1])
	return gridLine
def getBoundLines(bbx, Zvalue ):
	lstPt = []
	lstLine = []
	lstPt.append(XYZ(bbx.Min.X, bbx.Min.Y, Zvalue))
	lstPt.append(XYZ(bbx.Max.X, bbx.Min.Y, Zvalue))
	lstPt.append(XYZ(bbx.Max.X, bbx.Max.Y, Zvalue))
	lstPt.append(XYZ(bbx.Min.X, bbx.Max.Y, Zvalue))
	for idx, pt in enumerate(lstPt):
		if idx == 0:
			lstLine.append(Line.CreateBound(lstPt[- 1], pt))
			lstLine.append(Line.CreateBound(lstPt[idx - 1], pt))			
	return lstLine		

activView = doc.ActiveView
cropBox = activView.CropBox 
viewRange = activView.GetViewRange()
cutOffset = viewRange.GetOffset(PlanViewPlane.CutPlane)

fecGrids = FilteredElementCollector(doc, activView.Id).OfClass(DatumPlane).ToElements()
outLst = []
boundLines = getBoundLines(cropBox, cutOffset)

for grid in fecGrids:
	newGLine = createDatumLine(boundLines, grid)
	if newGLine:
		grid.SetCurveInView(DatumExtentType.ViewSpecific, activView, newGLine)

OUT = outLst

at least i think it is not just copy paste… how can i access this “distance”?

the code has no input. works in current view … is there even a package for this issue?

Hi @Draxl_Andreas
you want to implement an offset (between bubbles and cropped lines ) ? the current script don’t work for you?

@c.poupin ,

We solved allready, with a different workflow… Thank you

1 Like