TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: capsochist on September 22, 2020, 05:27:19 PM

Title: Partial CUI Load ACADDOC
Post by: capsochist on September 22, 2020, 05:27:19 PM
Hi there,

I have the following block of code in my ACADDOC.lsp file which checks a few system variables upon startup. I am wondering how to add a block of code that checks whether a Partial CUI is loaded at startup in the same way as opposed to writing (
Code - Auto/Visual Lisp: [Select]
  1. command "menuload" "acad"
) which doesn't check that it is loaded, but instead just force loads it regardless.


Code - Auto/Visual Lisp: [Select]
  1. (foreach sys
  2.    '(
  3.         (pdfshx     0)
  4.         (epdfshx    0)
  5.         (imageframe 2)
  6.         (pdfframe   2)
  7.         (pellipse   1)
  8.         (fontalt        "arial")
  9.     )
  10.     (if (getvar (car sys)) (apply 'setvar sys))
  11. )
Title: Re: Partial CUI Load ACADDOC
Post by: BIGAL on September 22, 2020, 08:17:06 PM
To quote Autodesk.

(menugroup groupname)

If groupname matches a loaded menu group name, the function returns the groupname string; otherwise, it returns nil.

Write a If to check if not then menuload.
Title: Re: Partial CUI Load ACADDOC
Post by: capsochist on September 22, 2020, 08:55:47 PM
this  seems to work...

Code - Auto/Visual Lisp: [Select]
  1. (if (not (menugroup "acad"))
  2.         (progn
  3.         (command "menuload" "acad"))
  4. )