Jump to content

draw symbol at line start points


Recommended Posts

Posted

Hi all,

 

Does anybody know a way in AutoCAD to select all (or some) of the polyline or line "start" points and draw a symbol or object (e.g. arrow, X, circle, etc...) at those points?

 

Appreciate any assistance.

Posted

There's always AutoLISP. Not sure how you would do that at the command prompt.

Posted

Create a block that you wish to use as your marker for the start points, and replace the red text with your block's name. The block should be located within your Support File Search Paths.

 

(defun c:MarkStartPoints  ( / blockName flag ss)
 (vl-load-com)
 (princ "\rMARK STARTPOINTS ")

 (setq blockName "[color=red]BlockName[/color]")

 (if (and (or (setq flag (tblsearch "block" blockName))
              (setq flag (findfile blockName)))
          (setq ss (ssget "_:L" '((0 . "LINE,*POLYLINE")))))
   ((lambda (i / e ctab space)
      (while (setq e (ssname ss (setq i (1+ i))))
        (vla-insertblock
          (cond (space)
                ((= "MODEL" (setq ctab (strcase (getvar 'ctab))))
                 (setq space (vla-get-modelspace
                               (vla-get-activedocument
                                 (vlax-get-acad-object)))))
                ((setq space (vla-get-paperspace
                               (vla-get-activedocument
                                 (vlax-get-acad-object))))))
          (vlax-3d-point (vlax-curve-getstartpoint e))
          blockName
          1.
          1.
          1.
          0.)))
     -1)
   (cond (flag (prompt "\n** Nothing selected ** "))
         ((prompt (strcat "\n** \"" blockName "\" cannot be found ** ")))))
 (princ))

 

Hope this helps!

Posted

not as elegant but you could draw your symbol once then copy it to each selected line using the END osnap.

 

Do you want the symbol at both ends or just the start, and if just the start will that always be the way it has been drawn? (If a line is drawn L-R the start will be at the other end to a line drawn R-L.)

Posted

Thanks Cyber, Render & dB for your replies! I have thousands of lines to mark, so I need something automated. Renderman's LISP program looks like it might do the trick. I'll test it out and let you all know how it goes.

  • 2 weeks later...
Posted
Create a block that you wish to use as your marker for the start points, and replace the red text with your block's name. The block should be located within your Support File Search Paths.

 

(defun c:MarkStartPoints  ( / blockName flag ss)
 (vl-load-com)
 (princ "\rMARK STARTPOINTS ")

 (setq blockName "[color=red]BlockName[/color]")

 (if (and (or (setq flag (tblsearch "block" blockName))
              (setq flag (findfile blockName)))
          (setq ss (ssget "_:L" '((0 . "LINE,*POLYLINE")))))
   ((lambda (i / e ctab space)
      (while (setq e (ssname ss (setq i (1+ i))))
        (vla-insertblock
          (cond (space)
                ((= "MODEL" (setq ctab (strcase (getvar 'ctab))))
                 (setq space (vla-get-modelspace
                               (vla-get-activedocument
                                 (vlax-get-acad-object)))))
                ((setq space (vla-get-paperspace
                               (vla-get-activedocument
                                 (vlax-get-acad-object))))))
          (vlax-3d-point (vlax-curve-getstartpoint e))
          blockName
          1.
          1.
          1.
          0.)))
     -1)
   (cond (flag (prompt "\n** Nothing selected ** "))
         ((prompt (strcat "\n** \"" blockName "\" cannot be found ** ")))))
 (princ))

 

Hope this helps!

Worked like a charm! Much thanks and props to Renderman.

Posted
Worked like a charm! Much thanks and props to Renderman.

 

Happy to help. :D

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