Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I need code that, depending on the existing value in Drawing Properties, would load certain lisp files. And if the required value is missing, it should be written in Custom Info. I'm newbie to Autolisp, and I don’t know how to make the if / else statements correctly, also, I don’t know how to check if an entry exists in Custom Info. I tried to make the code, as I see it, but how to make it work?
(defun c:LoadScale (/ App Doc DwgProps)
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
DwgProps (vla-Get-SummaryInfo Doc)
)
; If one of the values exists in custom info, then lsp file must be loaded:
(if (CustomInfo "Scale" "1:100") load "100.lsp")
(if (CustomInfo "Scale" "1:200") load "200.lsp")
(if (CustomInfo "Scale" "1:500") load "500.lsp")
; Otherwise, write the value and load lsp file:
(vla-AddCustomInfo DwgProps "Scale" "1:500")
(load "500.lsp")
(princ)
)
Solved! Go to Solution.