Jump to content

Recommended Posts

Posted

Thank for all replies,even the benefit for everyone, I found lisp by lee mac I think it it gave to me best result thank for everyone.:)

  • 3 weeks later...
  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • mostafa badran

    11

  • lucas3

    4

  • BIGAL

    3

  • JamCAD

    3

Top Posters In This Topic

Posted Images

Posted

Well finally did it pick points and you have 3 options

 

Enter 3 offsets pline 3 units auto to the right

 

Enter -5,2 offsets pline 5 units auto to the left and with a width of 2

 

Enter -5,2,140 offsets pline 5 units auto to the left and with a width of 2 and with a colour of 140

 

This could be modified to do lots of things pline on layer 22,5,125,GRND you get the idea

 

Multipline.jpg

 

; multiple pline including width & col function
; single entry is offset only
; two values 3,1 means offset 3 with width 1
; three values 3,2,1 means offset 3 with start width 2 end 1
; by Alan H March 2014
; thanks to Lee-mac for this defun
(defun _csv->lst ( str / pos )
(if (setq pos (vl-string-position 44 str))
   (cons (substr str 1 pos) (_csv->lst (substr str (+ pos 2))))
   (list str)
   )
)

(defun aH:multpl ( / pt1 pt2 pt3 obj1 obj2 dist1 pwidst plcol lst howmany)
(setvar "PLINEWID" 0) ;set PL width to 0
(command "_pline")
(while (= (getvar "cmdactive") 1 ) (command pause)
)
(setq pt1 nil)
(setq obj1 (entlast)) ; grab pline
(setq pt1 (getvar "lastpoint")) ; last pt
(command "circle" pt1 100.0) ; do something smart here like screen scale for circle
(setq obj2  (entlast)) ;grab circle
(setq pt2 (vlax-invoke (vlax-ename->vla-object obj1) 'intersectWith (vlax-ename->vla-object obj2) acextendnone)); find int point
(setq ang (angle pt1 pt2)) ;angle of pline now know left right
(command "erase" "last" "") ; remove circle
(while (/= (setq offval (getstring "Enter offset distance -ve for left")) "")
(setq lst (cons (_csv->lst offval) lst))
(setq howmany (length (nth 0 lst))) ;determines single or multi answer
(if (= howmany 1)(setq dist1 (atof (nth 0 (nth 0 lst)))) )
(if (= howmany 2)
  (progn
  (setq dist1 (atof (nth 0 (nth 0 lst)))) 
  (setq pwidst (atof (nth 1 (nth 0 lst)))) 
  ) ; progn
); if 
(if (= howmany 3)
  (progn
  (setq dist1 (atof (nth 0 (nth 0 lst)))) 
  (setq pwidst (atof (nth 1 (nth 0 lst)))) 
  (setq pLcol (atof (nth 2 (nth 0 lst))))
  ) ; progn
); if 

(if (> dist1 0.0)
(setq pt3 (polar pt2 (+ ang (/ pi 2.0)) (abs dist1)))
(setq pt3 (polar pt2 (- ang (/ pi 2.0)) (abs dist1)))
)
(command "offset" (abs dist1) obj1 pt3 "")
(if (>= howmany 2)
(vla-put-ConstantWidth (vlax-ename->vla-object (entlast)) pwidst)
)
(if (= howmany 3)
(vla-put-color (vlax-ename->vla-object (entlast)) plcol) ; note color as a number
)
) ; end while
(command "erase" obj1 "")
) ; end defun

(AH:multpl)
 (princ)

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...