Jump to content

Is programmatically possible to know if there's a hatch inside a closed 2dpolyline?


Recommended Posts

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • CesarA

    12

  • CadFrank

    9

  • Tharwat

    5

  • Lee Mac

    3

Top Posters In This Topic

Posted

Hi,

 

Well the best thing to do is to close your 2d polyline :P

Posted

LOL.. i'll be damned.. Yes, I meant a closed 2dpolyline.. and what after it?

Posted

Well you would need to select the area.. is it because your hatch scale is not good?

 

If you just made a hatch and you dont see it, it's because your 2d polyline isn't really closed.

 

Look in Pedit to make sure

Posted

Not really, what I wanna do is select a bunch of closed polylines, like these:

 

216c90a8a9.png

 

And I wanna fill those who have no hatch.

Posted

Oh!! well that's a hard one! but using select similar it should help, then you'd be able to unselect using shift the ones that have a hatch.. thats how i'd do it.

Posted

Hi,

 

Just retrieve the coordinate points of each polyline then use the function ssget with mode string "_CP" or "_WP" with filter to hatch objects only and you'd be there. :)

Posted

But in that case you are assuming the empty ones have the same dimensions.. well.. they don't :\

Posted

Thanks tharwat, I'll study the case. Did you see anyone implement such code?

Posted

Not sure he know Autolisp Programming :P

Posted

your best option with no programming is select similar.. or else well it's to deep for my knowledge of Autolisp

Posted

But Frank, there's a reason i'm posting this in a programming section :P thanks anyway :)

Posted

I figured you had one :D

 

Well no problem wasnt much help :P

Posted
Thanks tharwat, I'll study the case. Did you see anyone implement such code?

 

I don't need to see.

 

Not sure he know Autolisp Programming :P

:lol:

Posted (edited)

Have a play with this simple and quickie one.

 

(defun c:test (/ ss i sn)
 (if (setq ss (ssget '((0 . "LWPOLYLINE"))))
   (repeat (setq i (sslength ss))
     (if (ssget "_CP"
                       (mapcar 'cdr
                               (vl-remove-if-not
                                 '(lambda (p) (= (car p) 10))
                                 (entget (setq sn (ssname ss (setq i (1- i)))))
                               )
                       )
                       '((0 . "HATCH"))
                     )
       (ssdel sn ss)
     )
   )
 )
 (sssetfirst nil ss)
 (princ)
)

Edited by Tharwat
Posted
Have a play with this simple and quickie one.

 

Don't want to give you any disrespect Tharwat. I think he wants the code to do this.. :D

 

But nice work !!

 

(defun c:test (/ ss i s sn)
 (if (setq ss (ssget '((0 . "LWPOLYLINE"))))
   (repeat (setq i (sslength ss))
     (if (setq s
                     (ssget
                       "_CP"
                       (mapcar 'cdr
                               (vl-remove-if-not
                                 '(lambda (p) (= (car p) 10))
                                 (entget (setq sn (ssname ss (setq i (1- i)))))
                               )
                       )
                       '((0 . "HATCH"))
                     )
              )
         
       (ssdel sn ss)
     )
   )
 )
 (sssetfirst nil ss)
 (princ)
)

 

I juste removed the not on the 4th line :D

 

Cheers.

Posted
Don't want to give you any disrespect Tharwat. I think he wants the code to do this.. :D

 

But nice work !!

 

I juste removed the not on the 4th line :D

 

Cheers.

 

Thank you Frank , you are right. ;)

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