Help need with customizing LISP...I'm almost there!

Help need with customizing LISP...I'm almost there!

lstarbird
Advocate Advocate
1,239 Views
13 Replies
Message 1 of 14

Help need with customizing LISP...I'm almost there!

lstarbird
Advocate
Advocate

I'm completely new to LISP, but after finding out that I could use them for deploying our typical configurations instead of importing profiles, CUIs & registry keys, for various reasons, it was time to give LISPs a shot as we prepare to migrate from Civil 3D 2014 to 2016.

 

I'm 75% done, but have a few options I'm not sure how to edit with LISPs:

 

1. If I manually import a custom CUI & set it as the current workspace, all is fine.  But if I attempt to load it with the MENU command, I get clouds with question marks.  Of course, adding the following code to my LISPs doesn't work either.  Is there another way to accomplish this?

 

(command "menu" "custom.cuix")

2. By default, the uniform background color for 2D model space is 33, 40, 48.  How could we set the sheet/layout to be the same instead of white?

 

3. Is there a way to turn info center off?  I can do it via registry...but would prefer LISP.  Also, this code didn't work for me:

 

(setenv "InfoCenterOn" 0)

4. How can we hide system printers?  No luck with the following code:

 

(setenv "HideSystemPrinters" 1)

5. How can I add a custom support path for our company's networked fonts folder while still keeping the default support paths so that everything works?

 

Thanks in advanced for the feedback!

0 Likes
Accepted solutions (3)
1,240 Views
13 Replies
Replies (13)
Message 2 of 14

hmsilva
Mentor
Mentor

Hi lstarbird,

i don't have AutoCAD in this laptop, so I can not offer much help in your other doubts, but for
(setenv "InfoCenterOn" 0) and (setenv "HideSystemPrinters" 1)
set the values as strings

 

(setenv "InfoCenterOn" "0")
(setenv "HideSystemPrinters" "1")

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 14

Ranjit_Singh
Advisor
Advisor
Accepted solution

Your uniform background can be set by

 

(setenv "Layout background" "3156001")

 You can find the details to get the RGB into True color on the internet.

 

Message 4 of 14

lstarbird
Advocate
Advocate

@hmsilva wrote:

Hi lstarbird,

i don't have AutoCAD in this laptop, so I can not offer much help in your other doubts, but for
(setenv "InfoCenterOn" 0) and (setenv "HideSystemPrinters" 1)
set the values as strings

 

(setenv "InfoCenterOn" "0")
(setenv "HideSystemPrinters" "1")

 

Hope this helps,
Henrique


Thanks Henrique, but unfortunately simply adding the quotes around the 0 & 1 didn't make a difference.  Could it be that these need to be executed after startup?

0 Likes
Message 5 of 14

lstarbird
Advocate
Advocate

@Ranjit_Singh wrote:

Your uniform background can be set by

 

(setenv "Layout background" "3156001")

 You can find the details to get the RGB into True color on the internet.

 


That worked perfectly...thanks! Smiley Happy

0 Likes
Message 6 of 14

lstarbird
Advocate
Advocate

I believe I may have found a way to add our networked fonts folder to the default support paths...but the funny thing is that it automatically adds it twice...once with case matching mine below...then again all lower case.  I'm not sure why, but it appears to be working.

 

(DEFUN AddSupportPath (dir / tmp Cpath)
  (VL-LOAD-COM)
  (SETQ	Cpath (GETENV "ACAD") tmp (STRCAT ";" dir ";"))
  (IF (NOT (VL-STRING-SEARCH dir cpath)) (SETENV "ACAD" (STRCAT Cpath ";" dir)))
  (PRINC)
)
(AddSupportPath "Y:\\DRC ACAD\\fonts")

I found this code from mid-awe here.  Any problems with this?

 

Also, any more thoughts about questions 1, 3 & 4 above?

 

Thanks again everyone!

0 Likes
Message 7 of 14

Shneuph
Collaborator
Collaborator
Accepted solution

Looks like adding the path twice is probably a case issue.  When you add it in all caps it's in the string in caps.  When you close and re-open cad it chnages the case to lower except for the drive letter.  Now the strings don't match (case) so it inserts it again.  Try this:

 

 

(DEFUN AddSupportPath (dir / Cpath)
  (VL-LOAD-COM)
  (SETQ	Cpath (GETENV "ACAD"));setq
  (IF (NOT (VL-STRING-SEARCH (strcase dir) (strcase cpath)))
    (SETENV "ACAD" (STRCAT Cpath ";" dir)))
  (PRINC)
  )
(AddSupportPath "Y:\\DRC ACAD\\fonts")

PS you don't need the tmp variable.  It wasn't used.

 

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 8 of 14

lstarbird
Advocate
Advocate

@Shneuph wrote:

Looks like adding the path twice is probably a case issue.  When you add it in all caps it's in the string in caps.  When you close and re-open cad it chnages the case to lower except for the drive letter.  Now the strings don't match (case) so it inserts it again.  Try this:

 

 

(DEFUN AddSupportPath (dir / Cpath)
  (VL-LOAD-COM)
  (SETQ	Cpath (GETENV "ACAD"));setq
  (IF (NOT (VL-STRING-SEARCH (strcase dir) (strcase cpath)))
    (SETENV "ACAD" (STRCAT Cpath ";" dir)))
  (PRINC)
  )
(AddSupportPath "Y:\\DRC ACAD\\fonts")

PS you don't need the tmp variable.  It wasn't used.

 


Ahhh good to know!  And that worked like a charm!  Thanks so much!

 

Am I right that registry keys are case sensitive but network paths are not?  If that's the case (pun intended), would it have been better to simply have added our custom path in all lower case to avoid the doubling up?

0 Likes
Message 9 of 14

lstarbird
Advocate
Advocate

Looks like I figured out how to turn off InfoCenter (question #3)!

 

(vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\InfoCenter" ) "InfoCenterOn" 0)

The only gotcha is that I have to open, close & reopen C3D for the change to show.  Seems to make sense though...the 1st open would apply the setting to the registry...the 2nd open would show the change.

0 Likes
Message 10 of 14

Shneuph
Collaborator
Collaborator

You could have added the path in the correct case.

So, you can't actually do ALL lowercase because the drive letter is uppercase.  (strcase mypath t) would have still caused a duplicate.

 

c:\\mypath is incorrect.  Cad will change it to C:\\mypath  then you'd have c:\\mypath and C:\\mypath

 

Best to compare the strings both using (strcase) so everything is uppercase during the comparison.  Then no matter what you type for the path you won't get the duplicate.

 

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 11 of 14

lstarbird
Advocate
Advocate

Woohoo!  Now that I figured out modifying registry keys, HideSystemPrinters is easy!

 

(vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\<<C3D_Imperial>>\\General" ) "HideSystemPrinters" 1)

Now I just need to figure out how to import & set our custom Workspace saved as a CUI as current...

0 Likes
Message 12 of 14

lstarbird
Advocate
Advocate

Anyone also know how to set the layout crosshairs to white?

0 Likes
Message 13 of 14

lstarbird
Advocate
Advocate

@Ranjit_Singh wrote:

Your uniform background can be set by

 

(setenv "Layout background" "3156001")

 You can find the details to get the RGB into True color on the internet.

 


Just curious...how did you track down this registry key?  I can't find the registry entry even when searching "3156001".

0 Likes
Message 14 of 14

Ranjit_Singh
Advisor
Advisor
Accepted solution

Look here It lists the various environment variables. If that is what you mean. If you are asking about the 3156001 value then just google "RGB to true color Auto LISP"

 

Manually, you can look the registry key here [HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R20.0\ACAD-E000:409\Profiles\<<something>>\Drawing Window]

and here

[HKEY_USERS\S-1-9-21-652762923-608277090-212552118-5469\Software\Autodesk\AutoCAD\R20.0\ACAD-E000:409\Profiles\<<something>>\Drawing Window]

 

Just make sure you look at the right AutoCAD version and profile