Jump to content

Recommended Posts

Posted

Try this ... :)

 

(defun c:Test (/ *error* p1 p2 e w)
 (vl-load-com)
 ;;; Tharwat 11. July. 2012  ;;;
 (defun *error* (msg)
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **"))
   )
   (princ)
 )
 (if (not (tblsearch "LAYER" "A-Wall-Patt"))
   (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord")
                  '(2 . "A-Wall-Patt") '(62 . 252) '(70 . 0))
   )
 )

 (if (and (setq p1 (getpoint "\n Specify first point :"))
          (setq p2 (getpoint p1 "\n Next point :"))
     )
   (setq e (entmakex (list '(0 . "LWPOLYLINE")
                           '(100 . "AcDbEntity")
                           '(100 . "AcDbPolyline")
                           '(8 . "A-Wall-Patt")
                           '(90 . 2)
                           '(70 . 0)
                           (cons 10 (trans p1 1 0))
                           (cons 10 (trans p2 1 0))
                     )
           )
   )
 )
 (if (setq w (getdist "\n Specify width of Polyline :"))
     (vla-put-constantwidth (vlax-ename->vla-object e) w)
   (princ)
 )
 (princ)
)

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Grigs

    14

  • Tharwat

    10

  • MSasu

    3

  • SLW210

    1

Top Posters In This Topic

Posted Images

Posted

Tharwat

 

I really appreciate all the help you've given me. One last thing. 'w' defines the width of the polyline. What if I wanted the width to be 0.5 inches less than the picked width? How would that code be implemented.

  • 2 weeks later...
Posted

Tharwat, the lisp routine works well. I just have 1 question. Is it possible to alter the lisp to that you can pick multiple points? For instance, if you had a corner situation. The lisp would let you keep picking points then you would pick the 2 points that define the width and the entire polyline would be that width.

Posted
  Grigs said:
Tharwat, the lisp routine works well. I just have 1 question. Is it possible to alter the lisp to that you can pick multiple points? For instance, if you had a corner situation. The lisp would let you keep picking points then you would pick the 2 points that define the width and the entire polyline would be that width.

 

Is this what you mean ..... ?

 

(defun c:Test (/ *error* e w)
 (vl-load-com)
;;; Tharwat 11. July. 2012  ;;;
 (defun *error* (msg)
   (or    (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
   (princ (strcat "\n** Error: " msg " **"))
   )
   (princ)
 )(setq e nil)
 (if (not (tblsearch "LAYER" "A-Wall-Patt"))
   (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord" ) '(100 . "AcDbLayerTableRecord" )
          '(2 . "A-Wall-Patt") '(62 . 252)
          '(70 . 0))
   )
 )
 (command "_.pline")
 (while (eq (getvar 'cmdactive) 1) (command pause))
 (if (setq w (getdist "\n Specify width of Polyline :"))
   (progn (vla-put-layer
        (setq e (vlax-ename->vla-object (entlast)))
        "A-Wall-Patt"
      )
      (vla-put-constantwidth e w)
   )
   (princ)
 )
 (princ)
)

Posted

Once again you came thru for me. Works perfectly. Thanks!!!

Posted
  Grigs said:
Once again you came thru for me. Works perfectly. Thanks!!!

You're welcome any time . :)

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