Jump to content

Rectangle to shape


Recommended Posts

It is a know fact that sometimes a lisp will fail due to scale of current view, has been for years a problem. My suggestion would be look at (setvar 'osmode 0) in your code, even osmode 1 "endpoint" is enough to snap to wrong points, you can reset osmode as often as you need in your code. 0 works for me 16384 is all off.

Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • Abrasive


  • Jamescalabut


  • Jonathan Handojo


  • mhupp


Top Posters In This Topic

Posted Images


I see osmde 16384 is like selecting nothing and also clicking F3 (object  Reference OFF), which avoids those silly fails in lisp programs.

I've been using "osmode" 0 due to my lack of knowledge, but your idea is far better.



Link to comment
Share on other sites

Here is my attempt. only need the two points and width. then use boundary to create the "rectangle". Should work 100% of the time unless the side entity's are two short or something is in between them.



or if you pick points are not close to the side entity's so that the mpt isn't in between them.


(defun C:FOO (/ ss dist pt1 pt2 mpt vec line)
  (setq ss (ssadd))
  (setq dist (/ (getreal "\nWidth: ") 2.0)
        pt1 (getpoint "\nSelect First Point:")
        pt2 (getpoint pt1 "\nSelect Scond Point:")
        MPT (mapcar '/ (mapcar '+ pt1 pt2) '(2 2 2))
        vec (mapcar '/ (mapcar '- pt2 pt1) (list (distance pt1 pt2) (distance pt1 pt2) (distance pt1 pt2)))
  (entmake (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 pt1) (cons 11 vec)))
  (setq line (vlax-ename->vla-object (entlast)))
  (vla-offset line dist)
  (ssadd (entlast) ss)
  (vla-offset line (- dist))
  (ssadd (entlast) ss)
  (vla-delete line)
  (vl-cmdf "_.-Boundary" "_non" MPT "")
  (vl-cmdf "_.Erase" SS "")



Edited by mhupp
Link to comment
Share on other sites

Nice idea making a bpoy etc, so much easier than calcs of intersectwith,  if want to keep the base line add (command "OOPS") after creating boundary and it will reappear.

Link to comment
Share on other sites

I like it!

The XLINES don't erase when I run it though? maybe a setting I need to change?


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.

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