Jump to content

LISP TO SELECT BOUNDARY/POLYLINE/POLYGON FROM TEXT INSIDE IT


Sandeep RC

Recommended Posts

2 hours ago, BIGAL said:

Either of these  versions will hatch this if its 2 plines.

 

image.png.2dd797f34d1f22abb5e27063a59e532c.png

 

For Sandeep RC if your confident that all the areas are closed in some way either version will work, I exploded the plines so it was all lines and worked fine.

 

; hatch boundary's 
; By AlanH Mar 2022

(defun c:lothatch1 ( / ss x ang ent pt)

(setq ss (ssget (list (cons 0 "*TEXT"))))

(setq  ang 0.0)
(setvar 'HPSCALE 5.0)
(setvar 'hpname "Ansi31")

(repeat (setq x (sslength ss))
  (setq pt (cdr (assoc 10 (entget (ssname ss (setq x (1- x)))))))
  (command "bpoly" pt "")
  (setq ent (entlast))
  (setvar 'hpang ang)
  (command "-hatch" "S" ent "" "")
  (setq ang (+ ang 0.25))
  (entdel ent)
)

(princ)
)

(defun c:lothatch2 ( / ss x ang ent pt)

(setq ss (ssget (list (cons 0 "*TEXT"))))

(setq  ang 0.0)
(setvar 'HPSCALE 5.0)
(setvar 'hpname "Ansi31")

(repeat (setq x (sslength ss))
  (setq pt (cdr (assoc 10 (entget (ssname ss (setq x (1- x)))))))
  (setvar 'hpang ang)
  (command "-hatch" pt "" "")
  (setq ang (+ ang 0.25)) ; radians

)

(princ)
)

 

This is best, working on text and mtext , closed polyline, non close pline.

Link to comment
Share on other sites

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