Jump to content

Recommended Posts

Posted

Hi everyone.

 

I am developing an application for AutoCAD, and need a routines in AutoLISP, or a SCRIPTs for autocad I do the following:

 

Select the entities that limit one or more Hatchs ...

 

Select a different entities with the line width greater than a certain value...

 

Thanks in advance

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

  • luiscarneirorm

    33

  • BlackBox

    12

  • Lee Mac

    11

  • Tharwat

    5

Top Posters In This Topic

Posted Images

Posted

To get all hatches in a drawing .

 


(setq htch (ssget "_x" '((0 . "HATCH")))) [/Code]

And to get lines that are equal to a specific length (in my example the length is 5.0)

 

[Code]
(defun c:test (/ ss i sset e)
(if
(setq ss (ssget "_x" '((0 . "LINE"))))
(repeat
(setq i (sslength ss))
(setq sset (ssname ss (setq i (1- i))))
(setq e (entget sset))
(if (not
(eq (distance (cdr (assoc 10 e)) (cdr (assoc 11 e))) 5.0)
)
(ssdel sset ss)
)
)
(princ)
)
(sssetfirst nil ss)
(princ)
)
[/Code]

[b]Tharwat[/b]

Posted (edited)
To get all hatches in a drawing .

 


(setq htch (ssget "_x" '((0 . "HATCH")))) [/Code]

 

I do not want to select the hatchs, but the lines that limit

 

 

And to get lines that are equal to a specific length (in my example the length is 5.0)

 

[Code]
(defun c:test (/ ss i sset e)
(if
(setq ss (ssget "_x" '((0 . "LINE"))))
(repeat
(setq i (sslength ss))
(setq sset (ssname ss (setq i (1- i))))
(setq e (entget sset))
(if (not
(eq (distance (cdr (assoc 10 e)) (cdr (assoc 11 e))) 5.0)
)
(ssdel sset ss)
)
)
(princ)
)
(sssetfirst nil ss)
(princ)
)[/Code]

[b]Tharwat[/b]

 

and here the goal is to filter lines, arcs, etc., with lineweigth ([b]not lenght[/b]) greater than 0.5 for example.

 

sorry my bad english :oops:

 

Thanks...

Edited by luiscarneirorm
Posted

hatch_limit.jpg

 

The marked limit is what I want to select

Posted
[ATTACH]28722[/ATTACH]

 

The marked limit is what I want to select

Just post ur drawing ^^

Posted
That's also not a line , it is a circle isn't it ?

 

yes. is this hatch limit of what I want to select

Posted

I believe he is wanting to select the hatch BOUNDARY.

 

He is also wanting to select all entities with a LINEWIDTH greater than a specified WIDTH.

 

QSELECT will do both.

Posted
I believe he is wanting to select the hatch BOUNDARY.

 

He is also wanting to select all entities with a LINEWIDTH greater than a specified WIDTH.

 

QSELECT will do both.

 

yes, that's what I want, but this function does not allow me to do this

Posted

Why does Qselect not work?

 

You must want something more.

Posted
Why does Qselect not work?

 

You must want something more.

 

I do not find the settings for this filter with the QSELECT

  • 1 month later...
Posted

QSELECT will select polylines with a specified *global width*

 

CT_qselect.png

Posted

My goal was to do that, but with a lisp routine, and not just for polylines, but for all types of entities.

 

And isn't the width, but yes the lineweigth.

 

Sorry the Inglish... :oops:

Posted
QSELECT will select polylines with a specified *global width*

 

[ATTACH=CONFIG]29701[/ATTACH]

 

You also have greater than, not equal, = equal and select all options for the operators.

Posted
My goal was to do that, but with a lisp routine, and not just for polylines, but for all types of entities.

 

Sorry the Inglish... :oops:

 

No worries; try this:

 

(defun c:SBW ()(c:SelectByWidth))
(defun c:SelectByWidth ( / width ss)
 (if (and (setq width (getreal "\nEnter width: "))
          (setq ss (ssget "_x" (list (cons 43 width)))))
   (sssetfirst nil ss)
   (prompt "\n** Nothing selected ** "))
 (princ))

Posted

with QSELECT I can do it, but if the entity has lineweigth by layer, it is not selected

Posted

Wait... I just saw that you revised your post:

 

And isn't the width, but yes the lineweigth.

 

So you want to select by LINEWIEGHT, and not by GLOBAL WIDTH? :unsure:

Posted

yes, that's it. Excuse the bad English

Posted

Your English is good.

 

Are the ENTITIES (the objects drawn in modelspace) assigned an individual lineweight, or are they all set to ByLayer, and the LAYER is assigned a lineweight?

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