Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gopt = Options()
- gopt.ComputeReferences = True
- view = doc.ActiveView
- gopt.View = view
- elem=IN[0]
- ref= ReferenceArray()
- d=IN[1]
- p1=Point.ByCoordinates(0,0)
- p2=Point.ByCoordinates(0,d)
- vec1=Vector.ByTwoPoints(p1,p2).ToXyz()
- p3=Point.ByCoordinates(d,0)
- vec2=Vector.ByTwoPoints(p1,p3).ToXyz()
- TransactionManager.Instance.EnsureInTransaction(doc)
- for t in IN[0]:
- k = UnwrapElement(t).GetBoundaries()
- for r in k:
- for i in r:
- line = i.ToProtoType()
- length=line.Length
- dirX=line.Direction.X/length
- dirY=line.Direction.Y/length
- a = i.GetEndPointReference(0)
- ref.Append(a)
- b = i.GetEndPointReference(1)
- ref.Append(b)
- newdim = doc.Create.NewDimension(doc.ActiveView, i, ref)
- newdim.ToDSType(False)
- if abs(dirX) < 0.1:
- ElementTransformUtils.MoveElement(doc,newdim.Id,vec2)
- else:
- ElementTransformUtils.MoveElement(doc,newdim.Id,vec1)
- ref.Clear()
- TransactionManager.Instance.TransactionTaskDone()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement