Author Topic: Please break my routine......  (Read 10356 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Please break my routine......
« on: March 18, 2014, 11:58:47 AM »
I have completely overhauled the routine that we use to draw leaders here, but before I release it to my users, I was wondering if anyone here might be willing to kick the tires and see if they can break it?

The Uleader command  (UL is a shortcut) can be used to draw leaders, modify existing leaders or align leaders.

The MLP command can be used to make leaders parallel.

The L2M command can be used to convert Qleaders or lines and text (or blocks) to mLeaders.

Please note that the mleaders.dwg has to be in a location that is listed in your support files.

EDIT: Updated routine to 3.0c to add various fixes, clearer prompts and an exit option.
EDIT: Updated routine to 3.0d to fix exit option
EDIT: Updated routine to 3.0F - But the modify option resets one  of the points to 0,0 for some reason.
EDIT: Updated routine to 3.0h - Fixes the bug in 3.0F
EDIT: Updated routine to 3.0i - Restores compatibility with versions 2014 and lower by using DDEDIT in these versions and TEXTEDIT in 2015
« Last Edit: March 27, 2014, 01:15:27 PM by cmwade77 »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Please break my routine......
« Reply #1 on: March 18, 2014, 12:40:39 PM »
Type UL and hit escape.

Edit *error* to have this:
Code: [Select]
(if mlObj (vla-highlight mlObj :vlax-false))
instead of
Code: [Select]
(vla-highlight mlObj :vlax-false)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #2 on: March 18, 2014, 01:55:28 PM »
Thank you Alan, I fixed this....looking forward to seeing what others come up with.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #3 on: March 18, 2014, 05:29:10 PM »
(AutoCAD Mechanical 2014 - 64 bit)

I get an error when using the "S" option, then selecting an existing leader and using the "A" option to change the arrow head.

Code: [Select]
Command: UL
Pick starting point of leader [Select leader to change or align]: S

Select leader to align [Multiple/** alignX **/alignY/** alignangLe **/Note/Typ/Poc(d)/cIvil/Arrowheads/Content]: A
** Error: bad argument type: 2D/3D point: 13 **

The arrow head changes, then the program crashes with the above error.

FYI - I am using the program from within the "uleader.dwg" file
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

trogg

  • Bull Frog
  • Posts: 255
Re: Please break my routine......
« Reply #4 on: March 18, 2014, 07:36:58 PM »
Chris,
This is very cool. I enjoy testing new stuff like this.

I noticed a couple of things:
1) After placing to leaders created by the routine's default settings, I wanted to try to align the 2 when the landings are on opposite sides of the text.
After starting the tool by using the UL command, I select the leader that will be aligned (according to the prompt in Picture 1)
Then The prompt stays the same but obviously it recognized the first selection because it highlights the first leader, so I select the 2nd leader that I want the first to be aligned to (picture 2).
Results in picture 3.
I was expecting the first leader to aligned to the second and that didn't happen, so maybe the prompts can be edited to be more clear.
Also note that when the leader is on different sides of the text, that the direction is retained. I actually don't think that this is a problem since I have needed this to be the desired result of an MLeader.
I don't know anything about the complexity of programming MLeaders so I don't know if making an option for when this situation arises so that there is a choice of which side the leader comes from is a real possibility.

Great job Chris
~Greg
« Last Edit: March 18, 2014, 07:47:33 PM by trogg »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #5 on: March 18, 2014, 07:49:38 PM »
(AutoCAD Mechanical 2014 - 64 bit)

I get an error when using the "S" option, then selecting an existing leader and using the "A" option to change the arrow head.

Code: [Select]
Command: UL
Pick starting point of leader [Select leader to change or align]: S

Select leader to align [Multiple/** alignX **/alignY/** alignangLe **/Note/Typ/Poc(d)/cIvil/Arrowheads/Content]: A
** Error: bad argument type: 2D/3D point: 13 **

The arrow head changes, then the program crashes with the above error.

FYI - I am using the program from within the "uleader.dwg" file

It's not designed to work within the uleader.dwg file. That is a supporting file that contains all of the mleader styles, as they are near impossible to create via LISP. There are all sorts of odd errors that happen when running from within the uleader.dwg file, because when you load the program, it partially inserts that file as a block.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #6 on: March 18, 2014, 07:53:52 PM »
Chris,
This is very cool. I enjoy testing new stuff like this.

I noticed a couple of things:
1) After placing to leaders created by the routine's default settings, I wanted to try to align the 2 when the landings are on opposite sides of the text.
After starting the tool by using the UL command, I select the leader that will be aligned (according to the prompt in Picture 1)
Then The prompt stays the same but obviously it recognized the first selection because it highlights the first leader, so I select the 2nd leader that I want the first to be aligned to (picture 2).
Results in picture 3.
I was expecting the first leader to aligned to the second and that didn't happen, so maybe the prompts can be edited to be more clear.
Also note that when the leader is on different sides of the text, that the direction is retained. I actually don't think that this is a problem since I have needed this to be the desired result of an MLeader.
I don't know anything about the complexity of programming MLeaders so I don't know if making an option for when this situation arises so that there is a choice of which side the leader comes from is a real possibility.

Great job Chris
~Greg

The prompts are correct, the results are not, so that is a bug that I need to resolve.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #7 on: March 19, 2014, 11:35:47 AM »
It's not designed to work within the uleader.dwg file. That is a supporting file that contains all of the mleader styles, as they are near impossible to create via LISP. There are all sorts of odd errors that happen when running from within the uleader.dwg file, because when you load the program, it partially inserts that file as a block.

I realized that after posting. Tried it again in a new drawing and its working. Only thing I noticed upon testing this morning was the program does not exit cleanly; after exiting the command line shows 'Unknown command "UL".' looks like there is problem with the code line:
Code: [Select]
(COMMAND "._TEXTEDIT" (ENTLAST) "")I don't think the last return is needed - at least not in AutoCAD 2014. You may want to cover your bases by making it like this:
Code: [Select]
(COMMAND "._TEXTEDIT" (ENTLAST))(while (not (equal (getvar "cmdnames") ""))(command ""))
EDIT: I also notice that when using the "S" option to align leaders:
1) It's difficult to understand what your aligning to what; the prompts need to be more explanitory.
2) After you align the 1st leader the command line is put into an endless loop and there is no option to exit, either by using ENTER or a key word, like "eXit" or something. The only way to exit is by hitting ESC, which brings up a console break error.
« Last Edit: March 19, 2014, 11:52:14 AM by PKENEWELL »
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #8 on: March 19, 2014, 12:45:34 PM »
It's not designed to work within the uleader.dwg file. That is a supporting file that contains all of the mleader styles, as they are near impossible to create via LISP. There are all sorts of odd errors that happen when running from within the uleader.dwg file, because when you load the program, it partially inserts that file as a block.

I realized that after posting. Tried it again in a new drawing and its working. Only thing I noticed upon testing this morning was the program does not exit cleanly; after exiting the command line shows 'Unknown command "UL".' looks like there is problem with the code line:
Code: [Select]
(COMMAND "._TEXTEDIT" (ENTLAST) "")I don't think the last return is needed - at least not in AutoCAD 2014. You may want to cover your bases by making it like this:
Code: [Select]
(COMMAND "._TEXTEDIT" (ENTLAST))(while (not (equal (getvar "cmdnames") ""))(command ""))
EDIT: I also notice that when using the "S" option to align leaders:
1) It's difficult to understand what your aligning to what; the prompts need to be more explanitory.
2) After you align the 1st leader the command line is put into an endless loop and there is no option to exit, either by using ENTER or a key word, like "eXit" or something. The only way to exit is by hitting ESC, which brings up a console break error.

All very valid points, thank you. And I was trying to figure out why it was giving me that error. I was previously using DDEDIT, which did require the return, but since that command may go away in future releases, I thought I should change it to the newer textedit command.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #9 on: March 20, 2014, 07:07:51 PM »
I have updated the first post to a newer version that hopefully clarifies the prompts (although I am wondering now if I can come up with a way to do a live preview instead), adds an exit option and fixes various bugs that are listed here and that I have found as well.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #10 on: March 21, 2014, 12:50:14 PM »
I have updated the first post to a newer version that hopefully clarifies the prompts (although I am wondering now if I can come up with a way to do a live preview instead), adds an exit option and fixes various bugs that are listed here and that I have found as well.

Did another test a bit ago. First thing I noticed is when using the "S" option to align leaders. On the menu you have 2 options that have the same Capital in the Keyword:

Select leader that is to be aligned [Multiple/alignX/** alignY **/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/eXit]:

If you try to switch back to "AlignX" option, program "eXit"s instead. Maybe use "E" for exit, instead of "X"?
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #11 on: March 21, 2014, 05:34:04 PM »
I have updated the first post to a newer version that hopefully clarifies the prompts (although I am wondering now if I can come up with a way to do a live preview instead), adds an exit option and fixes various bugs that are listed here and that I have found as well.

Did another test a bit ago. First thing I noticed is when using the "S" option to align leaders. On the menu you have 2 options that have the same Capital in the Keyword:

Select leader that is to be aligned [Multiple/alignX/** alignY **/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/eXit]:

If you try to switch back to "AlignX" option, program "eXit"s instead. Maybe use "E" for exit, instead of "X"?
Yes, good catch....grr.....I'll get it one of these days.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #12 on: March 25, 2014, 01:12:00 PM »
I have updated the first post to a newer version that hopefully clarifies the prompts (although I am wondering now if I can come up with a way to do a live preview instead), adds an exit option and fixes various bugs that are listed here and that I have found as well.

Did another test a bit ago. First thing I noticed is when using the "S" option to align leaders. On the menu you have 2 options that have the same Capital in the Keyword:

Select leader that is to be aligned [Multiple/alignX/** alignY **/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/eXit]:

If you try to switch back to "AlignX" option, program "eXit"s instead. Maybe use "E" for exit, instead of "X"?
I have modified the original post to update to the E for exit option.

ribarm

  • Gator
  • Posts: 3282
  • Marko Ribar, architect
Re: Please break my routine......
« Reply #13 on: March 26, 2014, 07:48:55 AM »
cmwade77, I've modified your version 3.0d to 3.0e... I did find that when leader is to be modified after creating one, and if you then choose twice "P" option then you choose again "P", routine will fail because original VLA-OBJECT definition was destroyed when changing BlockContentType, so I couldn't escape doing copybase, pasteclip variant in my revision as I couldn't get correct VLA-OBJECT definitions in some other way... It isn't such a big deal, user can't even register when mlobj VLA-OBJECT was switched and further more now option "C" is working in the same manner as "P" option... You can cycle in modify mode of c:uleader all the time you want - it won't break, and when you wish to exit there is now your new "E" option...

Please, verify that my mods are useful...
M.R.
« Last Edit: March 27, 2014, 05:54:33 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3282
  • Marko Ribar, architect
Re: Please break my routine......
« Reply #14 on: March 26, 2014, 07:12:07 PM »
I've revised 3.0e version once more... Thanks for your patience, you can download now...

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #15 on: March 26, 2014, 08:03:12 PM »
Ok, that works; however, I had a situation where I was in the middle of testing it and needed to use the clipboard for something else, so I am trying to avoid using the clipboard.

I have updated the first post with 3.0F, but it seems to set one of the points to 0,0 for some reason when it kicks in, otherwise it works ok. Any ideas?

ribarm

  • Gator
  • Posts: 3282
  • Marko Ribar, architect
Re: Please break my routine......
« Reply #16 on: March 27, 2014, 04:19:33 AM »
I don't know what is it - it's bug in (VL Mleader) object... I thought that safearray was wrong - you've written '(1 . 6) and in some examples on www I found '(0 . 5), but that didn't fix it... Here is my portion of your mods :

Code: [Select]
(cond
((and (= *Content* "MTEXT") (= *POC* nil))
(if (/= (vla-get-ContentBlockName mlobj) "")
(progn
(if (null newpoints3) (setq newpoints3 (vla-GetLeaderLineVertices mlobj 0)))
(if (and (/= mlobj nil) (not (vlax-erased-p mlobj)))
(progn
(vla-delete mlobj)
(vlax-release-object mlobj)
)
)
(if (or (/= (getvar "cvport") 1) (/= (getvar "tilemode") 0))
(progn
                                                                                                (setq np3 (vlax-make-safearray vlax-vbDouble '(0 . 5)))
                                                                                                (setq np3 (vlax-safearray-fill np3 (vlax-safearray->list (vlax-variant-value newpoints3))))
(setq mlobj (vla-AddMleader *modelspace* np3 0))
                                                                                                (vla-update mlobj)
(vla-SetLeaderLineVertices mlobj 0 np3)
)
(progn
                                                                                                (setq np3 (vlax-make-safearray vlax-vbDouble '(0 . 5)))
                                                                                                (setq np3 (vlax-safearray-fill np3 (vlax-safearray->list (vlax-variant-value newpoints3))))
(setq mlobj (vla-AddMleader *paperspace* np3 0))
                                                                                                (vla-update mlobj)
(vla-SetLeaderLineVertices mlobj 0 np3)
)
)
(vla-put-StyleName mlobj (GETVAR "CMLEADERSTYLE"))
(setq TstObj mlobj)
)
)
(if (or (= *TEXT* "") (= *TEXT* nil))
(vla-put-TextString mlobj "BREEN\\PENGINEERING")
(vla-put-TextString mlobj *TEXT*)
)
(if (> (car pt1) (car FxPt))
(vla-put-TextJustify mlobj acAttachmentPointTopRight)
)
); End of condition

I've also noticed that in my version 3.0e when changing arrowstyle and pointstyle more times, sometimes leader slightly makes displacement at text insert point, so I've included this line :

Code: [Select]
(if (null lstpt) (setq lstpt (vla-GetLeaderLineVertices mlobj 0)))

instead of just :
Code: [Select]
(setq lstpt (vla-GetLeaderLineVertices mlobj 0))

This change will make sure first LeaderLineVertices are obtained and then no matter how much you change arrowstyle or pointstyle, position remains unchanged... You have to test this... I'll update my attachment once again with this change...

M.R.
« Last Edit: March 27, 2014, 05:16:28 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3282
  • Marko Ribar, architect
Re: Please break my routine......
« Reply #17 on: March 27, 2014, 05:45:42 AM »
It seems that only solution is (command "_.mleader" '(0.0 0.0) '(1.0 1.0) "") that is later modified... So here is my final working version without Clipboard...

uleader-3.0g.lsp

M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #18 on: March 27, 2014, 11:55:01 AM »
It seems that only solution is (command "_.mleader" '(0.0 0.0) '(1.0 1.0) "") that is later modified... So here is my final working version without Clipboard...

uleader-3.0g.lsp

M.R.
Grr....I hate when I have to use command like this, I find that it is generally slower, but I suppose one throughout the command isn't too bad. I do wonder if vl-cmdf will work, it's usually slightly faster....I'll test both and see.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #19 on: March 27, 2014, 12:57:58 PM »
Ok, I made a few changes to your code to speed this up and reduce screen flicker and updated the original post with uleader-3.0h

  • Since vla functions aren't used, removed the check for paper/model space
  • Uses the vl-cmdf function instead of the command function
  • Leader now initially draws at the correct coordinates, so there is no need to update afterwards
  • New leader is now drawn before the old one is removed to reduce screen flicker

I also had to put the end of the code back to textedit, as DDedit is no longer available in AutoCAD 2015. But I am not sure what version of Autocad this command was introduced in, so I need to do some research there.

Update: Turns out that textedit doesn't always work well in 2014 and lower, so I have updated the original code to always use DDEDIT on older versions and TEXTEDIT on newer versions. Original post has been updated with uleader-3.0i
« Last Edit: March 27, 2014, 01:16:52 PM by cmwade77 »

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #20 on: March 28, 2014, 11:08:51 AM »
I noticed this issue on the following sequence:
1) Use "S" option to align leaders by "Y" direction.
2) Leader Flips to opposite side (shouldn't do this)
3) Grip stretch the leader to the correct side.
4) Start UL again and select "S" option to align leader segments again.
5) After selecting leader to align, I get an "Automation Error: Invalid Input", and the leader is missing its dogleg.
4) if I use "Undo" - it goes back to the point before I did the grip stretch. (If think you need to close the Undo mark in your error traping routine)

my command Line:
Code: [Select]
Command: UL

Pick starting point of leader [Select leader to change or align to]: s

Select leader that is to be aligned [Multiple/alignX/** alignY **/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/Exit]:

** STRETCH **
Specify stretch point or [Base point/Copy/Undo/eXit]
Command: *Cancel*

Command: UL

Pick starting point of leader [Select leader to change or align to]: s

Select leader that is to be aligned [Multiple/** alignX **/alignY/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/Exit]:
** Error: Automation Error. Invalid input **

I see three problems here:
1) On the 1st align - It should not flip the leader to the opposite side.
2) the "Automation Error" and resulting leader missing the dogleg.
3) "Undo" should only undo the last attempt at aligning, and not be altering my prior manual Grip Stretch.

Otherwise - So far your program is very nice. I like the automatic alignment feature  :-)

EDIT - NOTE: I did not see this problem when using "X" Alignment. However, the Undo still kills my previous Grip Edit. You need to look at where you undo marks are getting set and closed.

EDIT2 - Looking at your code now, I see you have not put in any Undo marks. You could solve that by putting a (vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object))) at the beginning of your "c:Uleader" routine, and (vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object))) at the end of the routine AND in your Error function.
« Last Edit: March 28, 2014, 11:35:28 AM by PKENEWELL »
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #21 on: March 28, 2014, 11:34:42 AM »
I noticed this issue on the following sequence:
1) Use "S" option to align leaders by "Y" direction.
2) Leader Flips to opposite side (shouldn't do this)
3) Grip stretch the leader to the correct side.
4) Start UL again and select "S" option to align leader segments again.
5) After selecting leader to align, I get an "Automation Error: Invalid Input", and the leader is missing its dogleg.
4) if I use "Undo" - it goes back to the point before I did the grip stretch. (If think you need to close the Undo mark in your error traping routine)

my command Line:
Code: [Select]
Command: UL

Pick starting point of leader [Select leader to change or align to]: s

Select leader that is to be aligned [Multiple/alignX/** alignY **/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/Exit]:

** STRETCH **
Specify stretch point or [Base point/Copy/Undo/eXit]
Command: *Cancel*

Command: UL

Pick starting point of leader [Select leader to change or align to]: s

Select leader that is to be aligned [Multiple/** alignX **/alignY/** alignangLe **/Note/Typ/Poc(d)/Arrowheads/Exit]:
** Error: Automation Error. Invalid input **

I see three problems here:
1) On the 1st align - It should not flip the leader to the opposite side.
2) the "Automation Error" and resulting leader missing the dogleg.
3) "Undo" should only undo the last attempt at aligning, and not be altering my prior manual Grip Stretch.

Otherwise - So far your program is very nice. I like the automatic alignment feature  :-)

EDIT - NOTE: I did not see this problem when using "X" Alignment. However, the Undo still kills my previous Grip Edit. You need to look at where you undo marks are getting set and closed.
I will take a look at it, but part of the aligning process is that it is supposed to also match the dogleg length, as that is a company standard here, when I post the next version, I will try to add comments to the lines that should be commented out to remove that. But the first two errors are definitely an issue and I have also been finding some issues with the undo command, so need to setup undo marks better.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #22 on: March 28, 2014, 11:39:36 AM »
I will take a look at it, but part of the aligning process is that it is supposed to also match the dogleg length, as that is a company standard here, when I post the next version, I will try to add comments to the lines that should be commented out to remove that. But the first two errors are definitely an issue and I have also been finding some issues with the undo command, so need to setup undo marks better.

NOTE: When I did the Grip Stretch - I only used the leader 2nd point. I did not stretch the dogleg in any way.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #23 on: March 28, 2014, 11:41:00 AM »
I will take a look at it, but part of the aligning process is that it is supposed to also match the dogleg length, as that is a company standard here, when I post the next version, I will try to add comments to the lines that should be commented out to remove that. But the first two errors are definitely an issue and I have also been finding some issues with the undo command, so need to setup undo marks better.

NOTE: When I did the Grip Stretch - I only used the leader 2nd point. I did not stretch the dogleg in any way.
Oh, ok, then that is definitely a problem and one that I thought I resolved previously, have you downloaded the latest version (3.0i) from the first post?

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #24 on: March 28, 2014, 11:47:38 AM »
Oh, ok, then that is definitely a problem and one that I thought I resolved previously, have you downloaded the latest version (3.0i) from the first post?

Yes - I was using version 3.0i.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #25 on: March 28, 2014, 11:50:57 AM »
Well - I haven't had more time to diagnose all your code, but attached is a copy I made of your code with added Undo marks. just search for "Pkenewell" (my commented lines). This works for getting the undo marks correct.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #26 on: March 28, 2014, 03:59:26 PM »
Well - I haven't had more time to diagnose all your code, but attached is a copy I made of your code with added Undo marks. just search for "Pkenewell" (my commented lines). This works for getting the undo marks correct.
Thank you, that was going to be on my list for next week.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #27 on: February 11, 2015, 05:30:56 PM »
I am finally getting back to this. I believe I have all of the bugs worked out, but I would like someone to confirm this. I have also added the ability to automatically select more than one leader to align by clicking on a blank area of the drawing when trying to select a leader to align.

Please let me know if you find problems with this routine.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #28 on: May 23, 2016, 11:02:16 AM »
I am finally getting back to this. I believe I have all of the bugs worked out, but I would like someone to confirm this. I have also added the ability to automatically select more than one leader to align by clicking on a blank area of the drawing when trying to select a leader to align.

Please let me know if you find problems with this routine.

Hi cmwade77,

My apologies that I haven't looked at this update until now - your recent post referring to it jogged my memory. I just tried out  3.0k however and immediately noticed an issue: It is deleting any object that lies under the 1st leader point (except selecting another mleader of course).

It has to do with the following lines in your code within the grread loop for re-writing the MLEADER object:
Code: [Select]
(if (and (/= mlobj nil) (not (vlax-erased-p mlobj)))
(vla-delete mlobj)
)

I think you are reusing the variable "mlobj" for the new MLEADER object without clearing it first from its usage at the first point selection, so it deletes the object under the selection before deleting the new MLEADER within the grread loop.

I solved the issue by adding a setq to clear the variable "mlobj" if the selected object is not a multileader:

Code: [Select]
(if (wcmatch (cdr (assoc 0 (entget (car ent)))) "*MULTILEADER*")
   (progn
      ;;; Your Modify mleader code ...
   )
   (setq mlobj nil) ;; Added this to clear the variable before it is used again.
)

Since it has been while you might have already solved this issue. If that is the case however, you should post your latest code in the first post of this thread if you are offering it as a solution for others.

This is an excellent program otherwise - very good work. It has helped me out with some of my own code structures for sure!  :-D
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #29 on: May 23, 2016, 11:35:43 AM »
I am finally getting back to this. I believe I have all of the bugs worked out, but I would like someone to confirm this. I have also added the ability to automatically select more than one leader to align by clicking on a blank area of the drawing when trying to select a leader to align.

Please let me know if you find problems with this routine.

Hi cmwade77,

My apologies that I haven't looked at this update until now - your recent post referring to it jogged my memory. I just tried out  3.0k however and immediately noticed an issue: It is deleting any object that lies under the 1st leader point (except selecting another mleader of course).

It has to do with the following lines in your code within the grread loop for re-writing the MLEADER object:
Code: [Select]
(if (and (/= mlobj nil) (not (vlax-erased-p mlobj)))
(vla-delete mlobj)
)

I think you are reusing the variable "mlobj" for the new MLEADER object without clearing it first from its usage at the first point selection, so it deletes the object under the selection before deleting the new MLEADER within the grread loop.

I solved the issue by adding a setq to clear the variable "mlobj" if the selected object is not a multileader:

Code: [Select]
(if (wcmatch (cdr (assoc 0 (entget (car ent)))) "*MULTILEADER*")
   (progn
      ;;; Your Modify mleader code ...
   )
   (setq mlobj nil) ;; Added this to clear the variable before it is used again.
)

Since it has been while you might have already solved this issue. If that is the case however, you should post your latest code in the first post of this thread if you are offering it as a solution for others.

This is an excellent program otherwise - very good work. It has helped me out with some of my own code structures for sure!  :-D
My apologies, I thought the current version posted had worked, I will look at this change in a little bit and make sure that it is in my latest version just in case it is wrong there too and update it.

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #30 on: May 23, 2016, 11:59:55 AM »
My apologies, I thought the current version posted had worked, I will look at this change in a little bit and make sure that it is in my latest version just in case it is wrong there too and update it.

Just to be clear in case I am wrong: Your latest at the end of the thread was "3.0k" and the one in the first post is "3.0i" which has if I recall the undo issues. I presumed that your latest code would be something higher than the "3.0i" or 3.0k" versions.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Please break my routine......
« Reply #31 on: May 23, 2016, 02:42:30 PM »
Hi cmwade77,

P.S. - just to be thorough, I just verified that version 3.0i has the same issue deleting the entity under the first pick point.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Please break my routine......
« Reply #32 on: March 02, 2022, 12:11:29 PM »
Hi cmwade77,

P.S. - just to be thorough, I just verified that version 3.0i has the same issue deleting the entity under the first pick point.

I have just completed Version 4.0a, which I believe fixes this issue (it is a complete rewrite, although there are some similar elements).

For clarity, I am posting this version and all future versions in this thread:
http://www.theswamp.org/index.php?topic=57418.new#new

Please respond there, I am simply putting this here as documentation.