Jump to content

Recommended Posts

Posted

Hi

 

I want to create a program witch converts 2d cross section to 3dpoint entyties witch are to be placed on cross-section axe on plan.

 

first i create new ucs orgin so vertex point x = 3dpoint xvalue; y = 3dpoint zvalue;

 

now I start programing:

 

 

 

;;a) First I get 2d cross section polyline vertex points from polyline.
(vl-load-com)
(setq acadObject (vlax-get-acad-object))
(and
 (setq theobj (car (entsel "\nSelect a Polyline: ")))
 (setq theobj (vlax-ename->vla-object theobj))
 (eq (vlax-get-property theobj 'ObjectName) "AcDbPolyline")
 (setq thelist (vlax-get theobj 'coordinates))
;;b) converting point coordinates from wsc to currentucs
 (setq n 0)
 (while (/= (nth n thelist) nil)
   (setq thelist1
      (cons
        (trans
          (list (nth n thelist) (nth (setq n (1+ n)) thelist))
          0
          1
        )                ;end trans
        thelist1
      )                ;end cons
   )                    ;end setq
   (setq n (1+ n))
 )                    ;end while
)
;;c) Rotateing ucs - determinig crosssecton axe 
(setq t1 (getpoint "\nOdaberite ishosište koordinatnog sustava"))
(setq t2 (getpoint "\nKliknite na točku na pozitivnoj strani"))
                   ;(vl-cmdf -.UCS "w")
(setq ms (vla-get-modelspace
      (vla-get-ActiveDocument
        (vlax-get-acad-object)
      )
    )
)
(setq lin1 (vla-addline
        ms
        (vlax-3d-point (trans t1 1 0))
        (vlax-3d-point (trans t2 1 0))
      )
)
(setq lin (vlax-vla-object->ename lin1))
(princ)
                   ;(command "._UCS" "e" lin)
(vl-cmdf "._UCS" "e" lin)
(entdel lin)
;;d) drawing points
(setq n 0)
(while (/= (nth n thelist1) nil)
 (setq    toc
    (trans
      (list (nth n thelist1) (nth (setq n (1+ n)) thelist1))
      1
      0
    )                ;end trans
 )                    ;end setq  
 (vla-addpoint ms
   (vlax-3d-point (list (nth 0 toc) 0.0 (nth 1 toc)))
 )
)
(setq toc nil)

(setq n (1+ n))
)                    ;end while

Posted

theres a much simpler way to do this if you block the pline rescale it to get back to 1:1 then explode and use rotate3d to stand vertical then xyz are correct in one go.

Posted

Yes, but how i do that in Autolisp???

 

theres a much simpler way to do this if you block the pline rescale it to get back to 1:1 then explode and use rotate3d to stand vertical then xyz are correct in one go.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...