Advertisement
Guest User

111

a guest
Jul 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. gopt = Options()
  2. gopt.ComputeReferences = True
  3. view = doc.ActiveView
  4. gopt.View = view
  5. elem=IN[0]
  6. ref= ReferenceArray()
  7. d=IN[1]
  8. p1=Point.ByCoordinates(0,0)
  9. p2=Point.ByCoordinates(0,d)
  10. vec1=Vector.ByTwoPoints(p1,p2).ToXyz()
  11.  
  12. p3=Point.ByCoordinates(d,0)
  13. vec2=Vector.ByTwoPoints(p1,p3).ToXyz()
  14.  
  15.  
  16. TransactionManager.Instance.EnsureInTransaction(doc)
  17. for t in IN[0]:
  18.     k = UnwrapElement(t).GetBoundaries()
  19.     for r in k:
  20.         for i in r:
  21.             line = i.ToProtoType()
  22.             length=line.Length
  23.             dirX=line.Direction.X/length
  24.             dirY=line.Direction.Y/length
  25.             a = i.GetEndPointReference(0)
  26.             ref.Append(a)
  27.             b = i.GetEndPointReference(1)
  28.             ref.Append(b)
  29.             newdim = doc.Create.NewDimension(doc.ActiveView, i, ref)
  30.             newdim.ToDSType(False)
  31.             if abs(dirX) < 0.1:
  32.                 ElementTransformUtils.MoveElement(doc,newdim.Id,vec2)
  33.             else:
  34.                 ElementTransformUtils.MoveElement(doc,newdim.Id,vec1)
  35.             ref.Clear()
  36. TransactionManager.Instance.TransactionTaskDone()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement