Jump to content

Rectangle to shape


Abrasive

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

    10

  • Jamescalabut

    4

  • Jonathan Handojo

    4

  • mhupp

    3

Top Posters In This Topic

Posted Images

 @BIGAL,

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.

Thanks,

 

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.

 

--edit

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

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