TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Oak3s on April 20, 2010, 03:25:11 PM

Title: Getpoint of 'pause'
Post by: Oak3s on April 20, 2010, 03:25:11 PM
The routine works well. I believe the routine is one originally from CAB's library. I dont have the information to give proper credit.

What we would like to do is pause the leader command so we can see the leader. Currently we see the 'line' the leader will be drawn on but we dont see the leader arrow. Its a little thing but would be cool if it showed up.

The hangup is we need to save the points in order to give the text a point to be based on.
Is there a way to "getpoint" of a pause (verbiage is probably totally wrong)

Code: [Select]
(setq PT1 (getpoint "\nPick Leader Start Point: "))
(setq PT2 (getpoint PT1 "\nPick Leader Second Point: "))
(if (> (car PT1) (car PT2))
(setq PT3 (polar PT2 0 (* DIMSC -0.125)))
(setq PT3 (polar PT2 0 (* DIMSC 0.125)))
)
(command ".leader" PT1 PT2 PT3 "" "" "None")
(if (> (car PT1) (car PT2))
(setq PT4 (polar PT3 0 (* DIMSC -0.0625)))
(setq PT4 (polar PT3 0 (* DIMSC 0.0625)))
)
Title: Re: Getpoint of 'pause'
Post by: ronjonp on April 20, 2010, 03:45:43 PM
Maybe something like this:

Code: [Select]
(setq dimsc (getvar 'dimscale))
(setq pt1 (getpoint "\nPick Leader Start Point: "))
(vl-cmdf ".leader" pt1 pause "" "" "None")
(setq pt2 (getvar 'lastpoint))
(entdel (entlast))
(vl-cmdf ".leader"
pt1
pt2
(if (> (car pt1) (car pt2))
   (setq pt3 (polar pt2 0 (* dimsc -0.125)))
   (setq pt3 (polar pt2 0 (* dimsc 0.125)))
)
""
""
"None"
)
(if (> (car pt1) (car pt2))
  (setq pt4 (polar pt3 0 (* dimsc -0.0625)))
  (setq pt4 (polar pt3 0 (* dimsc 0.0625)))
)

**You should look into mleaders and mleader styles.
Title: Re: Getpoint of 'pause'
Post by: Oak3s on April 20, 2010, 04:42:22 PM
Ah, I was thinking about something similar. Create a leader and then delete it. That solved that. Thanks again. Works very nice.
As for mleaders...great idea and we have had the discussion in the company before. Problem seems to be our detail library is packed with leaders and text...not mleaders.  :cry: maybe someday.
Thanks again.
Title: Re: Getpoint of 'pause'
Post by: ronjonp on April 20, 2010, 04:53:27 PM
...  Problem seems to be our detail library is packed with leaders and text...not mleaders.  :cry: maybe someday.
Thanks again.

Perhaps this would be of help to clean them up:

http://www.theswamp.org/index.php?topic=30934.msg364891#msg364891
Title: Re: Getpoint of 'pause'
Post by: alanjt on April 20, 2010, 05:05:43 PM
Slick Ron. :)

You should store (entlast) before issueing the first leader command with Pause for comparison. That way, if the user doesn't specify a second point, the routine won't continue and erase some other object.

Maybe something like this:

Code: [Select]
(setq dimsc (getvar 'dimscale))
(setq pt1 (getpoint "\nPick Leader Start Point: "))
(vl-cmdf ".leader" pt1 pause "" "" "None")
(setq pt2 (getvar 'lastpoint))
(entdel (entlast))
(vl-cmdf ".leader"
pt1
pt2
(if (> (car pt1) (car pt2))
   (setq pt3 (polar pt2 0 (* dimsc -0.125)))
   (setq pt3 (polar pt2 0 (* dimsc 0.125)))
)
""
""
"None"
)
(if (> (car pt1) (car pt2))
  (setq pt4 (polar pt3 0 (* dimsc -0.0625)))
  (setq pt4 (polar pt3 0 (* dimsc 0.0625)))
)

**You should look into mleaders and mleader styles.
Title: Re: Getpoint of 'pause'
Post by: Oak3s on April 21, 2010, 11:42:16 AM
How would you go about doing that?

Code: [Select]
(setq ent1 (entlast)) But I dont know what to do with that. :|

This was an idea i tried...not working.
Code: [Select]
(setq PT1 (getpoint "\nSpecify first leader point: "))
(princ "\nSpecify next point: ")
(vl-cmdf ".leader" pt1 pause "" "" "None")
(setq pt2 (getvar 'lastpoint))
(if (> pt2 nil)(entdel (entlast))) ;;; I am missing something because this isnt working as I thought
Title: Re: Getpoint of 'pause'
Post by: Lee Mac on April 21, 2010, 12:03:36 PM
Perhaps:

Code: [Select]
(setq LastEntity (entlast))
(setq dimsc (getvar 'dimscale))
(setq pt1 (getpoint "\nPick Leader Start Point: "))
(vl-cmdf ".leader" pt1 pause "" "" "None")
(setq pt2 (getvar 'lastpoint))
(if (not (equal LastEntity (entlast)))
  (progn
    (entdel (entlast))
    (vl-cmdf ".leader"
pt1
pt2
(if (> (car pt1) (car pt2))
   (setq pt3 (polar pt2 0 (* dimsc -0.125)))
   (setq pt3 (polar pt2 0 (* dimsc 0.125)))
)
""
""
"None"
      )
    (if (> (car pt1) (car pt2))
      (setq pt4 (polar pt3 0 (* dimsc -0.0625)))
      (setq pt4 (polar pt3 0 (* dimsc 0.0625)))
    )
  )
)

Be sure to use the correct function (equal, eq or =)  :-)
Title: Re: Getpoint of 'pause'
Post by: alanjt on April 21, 2010, 12:05:10 PM
Precisely what I was getting at. :kewl:
Perhaps:

Code: [Select]
(setq LastEntity (entlast))
(setq dimsc (getvar 'dimscale))
(setq pt1 (getpoint "\nPick Leader Start Point: "))
(vl-cmdf ".leader" pt1 pause "" "" "None")
(setq pt2 (getvar 'lastpoint))
(if (not (equal LastEntity (entlast)))
  (progn
    (entdel (entlast))
    (vl-cmdf ".leader"
pt1
pt2
(if (> (car pt1) (car pt2))
   (setq pt3 (polar pt2 0 (* dimsc -0.125)))
   (setq pt3 (polar pt2 0 (* dimsc 0.125)))
)
""
""
"None"
      )
    (if (> (car pt1) (car pt2))
      (setq pt4 (polar pt3 0 (* dimsc -0.0625)))
      (setq pt4 (polar pt3 0 (* dimsc 0.0625)))
    )
  )
)

Be sure to use the correct function (equal, eq or =)  :-)
Title: Re: Getpoint of 'pause'
Post by: Oak3s on April 21, 2010, 12:20:34 PM
Awesome! Thank you both.
Title: Re: Getpoint of 'pause'
Post by: ronjonp on April 21, 2010, 01:10:59 PM
I still vote for Mleaders  :-P
Title: Re: Getpoint of 'pause'
Post by: Oak3s on April 21, 2010, 01:13:43 PM
Oh yeah, I forgot to mention that I followed the link above and the routine is great. I am going to look more into it when time is available. Thanks for the recommendation. If only mtext wasnt a pain to edit...specifically ENTER/RETURN to close. I read something about 2011 having something new to do with this....hmmmm...
Title: Re: Getpoint of 'pause'
Post by: alanjt on April 21, 2010, 01:20:19 PM
I still vote for Mleaders  :-P
Ditto :love:
Title: Re: Getpoint of 'pause'
Post by: CAB on April 21, 2010, 01:36:58 PM
Oh yeah, I forgot to mention that I followed the link above and the routine is great. I am going to look more into it when time is available. Thanks for the recommendation. If only mtext wasnt a pain to edit...specifically ENTER/RETURN to close. I read something about 2011 having something new to do with this....hmmmm...
Quote
Hit ctrl+enter to exit the edit mtext command.
Also, picking outside the editor window is as good as enter or ctrl+enter and a bit faster to boot.
Title: Re: Getpoint of 'pause'
Post by: Lee Mac on April 21, 2010, 01:45:43 PM
Quote
Hit ctrl+enter to exit the edit mtext command.
Also, picking outside the editor window is as good as enter or ctrl+enter and a bit faster to boot.

Didn't know that! Thanks Alan  :-)
Title: Re: Getpoint of 'pause'
Post by: CAB on April 21, 2010, 03:06:47 PM
You're welcome.
More mtext tips:
http://www.theswamp.org/index.php?topic=28950.0
Title: Re: Getpoint of 'pause'
Post by: alanjt on April 21, 2010, 09:50:56 PM
Quote
Hit ctrl+enter to exit the edit mtext command.
Also, picking outside the editor window is as good as enter or ctrl+enter and a bit faster to boot.

Didn't know that! Thanks Alan  :-)
Boo clicking OK
Title: Re: Getpoint of 'pause'
Post by: Bob Wahr on April 22, 2010, 04:19:56 PM
I still vote for Mleaders  :-P
He's dealing with a mentality that won't allow multiple layout tabs in one of their offices because a couple of the drafters (the "CAD Manager" being (the main) one of them) can't remember to look to see if there are other tabs when they plot and don't notice that they are missing sheets before a) giving drawings to the engineer or b) sending jobs out.
Title: Re: Getpoint of 'pause'
Post by: Oak3s on April 22, 2010, 04:54:59 PM
 :lol: To true...
Title: Re: Getpoint of 'pause'
Post by: Bob Wahr on April 22, 2010, 05:34:47 PM
I don't miss that.  Not for a second.

Back on to the side discussion though, I decided to go with mtext and mleaders in this office and am generally happy with the decision although I run into a few quirks at times that bug a bit.  The one negative that I have with MTEXT though, especially on single line text, is the ability to edit the text in the properties bar.
Title: Re: Getpoint of 'pause'
Post by: alanjt on April 22, 2010, 07:17:01 PM
I don't miss that.  Not for a second.

Back on to the side discussion though, I decided to go with mtext and mleaders in this office and am generally happy with the decision although I run into a few quirks at times that bug a bit.  The one negative that I have with MTEXT though, especially on single line text, is the ability to edit the text in the properties bar.
I've never understood why they made that available (or really just made it unavailable). You can access all the formatting codes.