Author Topic: Helix problem  (Read 916 times)

0 Members and 1 Guest are viewing this topic.

LogicTools

  • Newt
  • Posts: 36
Helix problem
« on: October 30, 2020, 02:07:26 PM »
Please load the code on a blank dwg.
There are 2 commands on the code:
Code - Auto/Visual Lisp: [Select]
  1. c:helix_on_world_ucs
  On World UCS creates 2 helix the second a perfect continuation of the other.
Code - Auto/Visual Lisp: [Select]
  1. c:helix_on_custom_ucs
Same code as before but on a custom UCS. The second helix is not drawn as a continuation of the first one.
Can somebody help me understand this.
Code - Auto/Visual Lisp: [Select]
  1. (defun set_act_ucs (/ ucsorg ucsxdir ucsydir xvec yvec act_ucs)
  2.  (setq
  3.   AcadObject     (vlax-get-acad-object)
  4.   AcadApp        (vla-get-Application AcadObject)
  5.   ActiveDocument (vla-get-ActiveDocument AcadApp)
  6.   UCSs           (vla-get-UserCoordinateSystems ActiveDocument)
  7.   ucsorg         '(35.5021 10.9139 -1.27168)
  8.   ucsxdir        '(-0.997401 -0.0720439 0.0)
  9.   ucsydir        '(0.0 0.0 1.0)
  10.   xvec           '()
  11.   yvec           '()
  12.  )
  13.  (mapcar '(lambda (o v) (setq xvec (append xvec (list (+ o v))))) ucsorg ucsxdir)
  14.  (mapcar '(lambda (o v) (setq yvec (append yvec (list (+ o v))))) ucsorg ucsydir)
  15.  (setq
  16.   act_ucs (vla-Add UCSs
  17.                    (vlax-3d-point ucsorg)
  18.                    (vlax-3d-point xvec)
  19.                    (vlax-3d-point yvec)
  20.                    "TEMP"
  21.           )
  22.  )  
  23.  (vla-put-ActiveUCS ActiveDocument act_ucs)  
  24. )
  25.  
  26. (defun helix_test (/ starts s_rad e_rad pitch ends step in_ang)
  27.  (setq
  28.   starts '(9 0 0)
  29.   s_rad  '(9 2 0)
  30.   e_rad  '(9 3 0)
  31.   pitch   1
  32.   ends   '(-1 0 0)
  33.   step   0.75
  34.   in_ang (angle ends starts)
  35.  )
  36.  (vl-cmdf "._helix" "_non" starts "_non" s_rad "_non" e_rad "_H" pitch "_A" "_non" ends)
  37.  (setq
  38.   e_rad   (list (car s_rad) (- (cadr s_rad) step) 0)
  39.   ends    (polar starts in_ang pitch)
  40.  )
  41.  (vl-cmdf "._helix" "_non" starts "_non" s_rad "_non" e_rad "_H" pitch "_A" "_non" ends)
  42.  (vl-cmdf "._zoom" "_e" "")
  43. )
  44.  
  45. (defun c:helix_on_world_ucs ()
  46.  (vl-cmdf "._ucs" "w" "")
  47.  (helix_test)
  48.  )
  49.  
  50. (defun c:helix_on_custom_ucs ()
  51.  (set_act_ucs)
  52.  (helix_test)
  53.  )
  54.