Author Topic: Redefining commands for shared versions?  (Read 4534 times)

0 Members and 1 Guest are viewing this topic.

KewlToyZ

  • Guest
Redefining commands for shared versions?
« on: March 22, 2009, 07:30:06 PM »
Good evening folks. I hope you are all having a great weekend!
I'm looking at a dilemna I created for myself by trying to blend 2007 & 2009 using the same directories for the network customizations. I still run into errors in some files 2007 will open where 2009 fails to open the file at all.
Also 2007 for basic use is a much less robust resource hog to do the same work.
I am keeping 2009 for my power users and 2007 for the less CAD intensive users who just open and markup files.
Both are now sharing the same commands, standards, toolbars and structures.

Here is the problem I ran into:
I was trying to figure out how to have 2007 redefine a few specific commands to different routines.
Specifically setting scale & profile repairs because 2007 is missing a few prompt bypasses that 2009 now has.
I want to use the same keyboard commands but have them read two completely different Autlisp files.
So undefine/redefine won't help from the way i understand their function.
The PGP file wont help since it will be the same file as well.
I am trying to keep the same basic commands so the help files, tutorials, and use remain comprehensive to the user regardless. I only have 3 specific lisp files i wanted to manage this with.

I wondered if anyone else has ran into this or can see a very simple means to do this I have overlooked?
I was hoping to use the individual MNL or acad200Xdoc.lsp files for each version to manage the altered command definitions?

Any way, thank you for your time, it is much appreciated.  ;-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Redefining commands for shared versions?
« Reply #1 on: March 22, 2009, 11:29:22 PM »
Let me ask an obvious question. Why don't you revise the lisp files?

First suggestion is to eliminate the Commands.

Failing that, why don't you detect which version of ACAD & use the proper prompt sequence?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #2 on: March 23, 2009, 09:52:45 AM »
Good morning CAB! Thanks for the response!
The scale list systems I am using were also combined with a dvb system menu.
The selections have greater range with the newer version.
The MEP 2009 system allows me to bypass the prompt for duplicate entries, 2007 however does not.
With 2007, If I prompt and there are no duplicates it errors out because I was trying to predict them when they were not there. It was the first version of their scalelistedit & cannoscale implementation. No updates fixed it until the next version of AutoCAD. It didn't have the new cannoscale control in the bottom of AutoCAD that runs the reactor.
I am not sure how to detect the entire list or iterate through the list in the drawing then only add the few necessary as a catch all? I am down to only one routine to "fix" and that is the set scale system.
« Last Edit: March 23, 2009, 09:59:36 AM by KewlToyZ »

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #3 on: March 23, 2009, 10:00:54 AM »
These are the routines I ended up with.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Redefining commands for shared versions?
« Reply #4 on: March 23, 2009, 10:00:58 AM »
Could you not use the "catch all" with the command & report back that the scale is not valid?
I only have 2006 so I can't test.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #6 on: March 23, 2009, 10:21:55 AM »
Kewl, thanks CAB!
That should get me moving forward with an alternative.
I was hoping to to get out of the corner I painted myself into with a redefinition of the command with a different version on startup. But the redefine doesn't work that way. The pgp filename is predefined internally so I can't make an 07 & 09 version of that I am aware of either. So either I recode the application for something that could phase out in a year, or force a new command in 2007 (the easiest for me). The two versions of AutoCAD structured it differently even though the file format is the same.

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #7 on: March 23, 2009, 02:47:28 PM »
I ended up following the redefining route by using the keyboard shortcut from the pgp file (removed it) set as the routine name and detecting the version to run:

Code: [Select]
; New SSC command to detect AutoCAD version before running type of scaling system.
;======================================================================================================================================
(defun c:SSC()
(autoload "SetSCL7" '("SetSCL7"))
(autoload "SetSCL9" '("SetSCL9"))
;(if (= test1 true1)
;(do_this1))
;(if (= test2 true2)
;(do_this2))


;============================== AutoCAD 2007 ==========================================================================================
; ACADVER = "17.0s (LMS Tech)"
;(if (= (vlax-product-key) "Software\\Autodesk\\AutoCAD\\R17.0\\ACAD-5001:409")
(if (= (getvar "ACADVER") "17.0s (LMS Tech)")


(c:SetSCL7)
(princ)
) ;End If
;============================== AutoCAD MEP 2009 ======================================================================================
; ACADVER = "17.2s (LMS Tech)"
;(if (= (vlax-product-key) "Software\\Autodesk\\AutoCAD\\R17.2\\ACAD-7006:409")
(if (= (getvar "ACADVER") "17.2s (LMS Tech)")


(c:SetSCL9)
(princ)
) ;End If

)
; removed from PGP file - SSC,       *SETSCALE

Thanks for the help CAB ;)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Redefining commands for shared versions?
« Reply #8 on: March 23, 2009, 02:49:29 PM »
You're welcome but I didn't do much. :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #9 on: March 23, 2009, 05:09:33 PM »
Hmmm I spoke too soon.
After closing and starting up again, 2007 says it has a syntax error with too many arguments, 2009 runs it fine...
 :lol: :lmao: :ugly: :| :cry:

I can run the routine I call for just fine, it just doesn't like my two if statements.
Autolisp doesnt have an else, just structures as if it has an else correct?

Nevermind, typo... duhhhh!
« Last Edit: March 23, 2009, 05:19:20 PM by KewlToyZ »

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Redefining commands for shared versions?
« Reply #10 on: March 23, 2009, 05:22:45 PM »
That's most likely related to a command call that has changed between the two versions.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #11 on: March 23, 2009, 05:26:07 PM »
LOL thanks ronjonp...
Nah I had some typing from another app end up in my routine before I closed the text editor.
Ended up trying to loop through both routines in 2007.

mkweaver

  • Bull Frog
  • Posts: 352
Re: Redefining commands for shared versions?
« Reply #12 on: March 24, 2009, 08:07:10 AM »
Take a look at this:http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=12638396&linkID=9240617:
Quote
Starting with AutoCAD 2009, command versioning was introduced with the Action Recorder. Command versioning allows AutoCAD to track which command iteration should be used when executing an action macro, script file, or command macro. As a result of this change, some commands might require the use of the ^R control sequence in the command macro.

This looks like it is directed at menu macros - I wonder if there is a way to use it a lisp command function.

Mike

KewlToyZ

  • Guest
Re: Redefining commands for shared versions?
« Reply #13 on: March 24, 2009, 03:00:05 PM »
Thanks mkweaver,
I had not read that before now.
Helpful to know for sure.