Author Topic: load acaddoc and acad lsp faster?  (Read 18969 times)

0 Members and 1 Guest are viewing this topic.

butzers09silverado

  • Guest
load acaddoc and acad lsp faster?
« on: July 12, 2011, 08:45:27 AM »
I'm trying to get the acad and acaddoc to load faster, anybody have suggestions?  I'm horrible at code.  FYI Some of the code has ; in front of them because they are "not in use"... easy way to keep the variables and not use them.

acad.lsp
Code: [Select]
; load system settings, vba, arx files

;(arxload "arxfile.arx")

(setvar "isavepercent" 0)
(setvar "filedia" 1)
(setvar "cmddia" 1)
(setvar "tooltips" 0)
(setvar "xrefnotify" 2)
(setvar "xloadctl" 2)
(setvar "visretain" 1)
(setvar "regenmode" 1)
(setvar "attmode" 1)
(setvar "attreq" 1)
(setvar "backgroundplot" 0)
(setvar "blipmode" 0)
(setvar "cmljust" 1)
(setvar "demandload" 3)
(setvar "draworderctl" 3)
(setvar "elevation" 0)
(setvar "fielddisplay" 1)
(setvar "fieldeval" 31)
(setvar "gridmode" 0)
(setvar "ucsvp" 0)
(setvar "XREFTYPE" 1)
(setvar "geomarkervisibility" 0)
(setvar "tooltips" 1)
(setvar "indexctl" 3)
(setvar "expert" 5)
(setvar "rollovertips" 0)
(setvar "publishcollate" 0)
;(setvar "hpdlgmode" 1)
;(setvar "layerdlgmode" 0)
(setvar "ssmautoopen" 0)
(setvar "OSNAPZ" 1)

here is the big bad one... acaddoc.lsp

Code: [Select]
; load only lisp and drawing settings in here

(setvar "mirrtext" 0)

(setvar "proxygraphics" 0)

;thaw and turn on layer 0
(command "-layer" "thaw" "0" "on" "0" "s" "0" "")

;creates thaws and turns on defpoints
(if (tblsearch "LAYER" "defpoints");;test if layer exists
(command "-layer" "thaw" "defpoints" "on" "defpoints" "") ;do this if exists
(command "-layer" "n" "defpoints" "c" "63" "defpoints" "");do this if not
)

;turns off wipeout frames
(command "wipeout" "f" "off")

;sets the view resoluton of circles on open
(command "viewres" "Y" "20000")

;set units for blocks dragged into drawing from design center
(command "insunits" 2)

;sets all fields in drawing to have gray background
(command "fielddisplay" 1)

;sets units of source drawings xreferenced or inserted into current drawing as unitless
(command "insunitsdefsource" 2)

;sets units of target or current drawings as unitless
(command "insunitsdeftarget" 2)

;forces to create a .bak file
(command "isavebak" 1)

;forces full saves
(command "isavepercent" 0)

;allows for 1000 layers to be sorted in a drawing
(command "maxsort" 10000)

;offsets polylines with no arcs
(command "offsetgaptype" 0)

;generates polyline linetype per segment instead of per total line
(command "savefidelity" 0)

;corrects annotative objects
(command "plinegen" 0)

;sets polyline width to 0 at drawing open
(command "plinewid" 0)

;sets polygon command to 3 sides instead of 4
(command "polysides" 3)

;sets ucsfollow to 0 so your screen doesn't follow ucs and zoom extents
(command "ucsfollow" 0)

;sets the available memory for raster images to 100mb instead of default 20mb
(setvar "rasterthreshold" 100)

;sets the maximum percent of the available virtual memory reserved for raster image plotting to 90% instead of default 20%
(setvar "rasterpercent" 90)

;sets your z elevation to 0
;(command "elevation" "0")
(setvar "elevation" 0)

;sets xrefs to remember layer state in drawing
(command "visretain" 1)

;sets you image frames to view but not print
(command "imageframe" 2)

;makes the stupid orb go away
(setvar "geomarkervisibility" 0)

;shuts off viewcube
(command "navvcubedisplay" OFF)

;shuts off navigation bar in viewport
(command "navbardisplay" 0)
(command "navvcube" off)

;shuts off navigation bar
(command "navbar" off)

;shuts off the grid
(command "gridmode" 0)

;resets the scale list in every drawing
;(command "-scalelistedit" "R" "Y" "E")

;sets the lineweight units to inches
(command "lwunits" 0)

;turns off lineweight display
(command "lwdisplay" "off")

;turns off ortho
(command "orthomode" 0)

;sets the autosave path
(command "savefilepath" C:\autosaves)


;sets viewport regen to require manual regen
(command "layoutregenctl" 2)


;not in use
;replaces xref menu with old type dialogue box
;(command "_.undefine" "xref")

;(defun c:xref nil (initdia) (command "_.classicxref"))

;replaces xref manager menu for classic images

;(command "_.undefine" "image")

;(defun c:image nil (initdia) (command "_.classicimage"))


kruuger

  • Swamp Rat
  • Posts: 625
Re: load acaddoc and acad lsp faster?
« Reply #1 on: July 12, 2011, 08:58:58 AM »
the best solution is to save template with all these variable set to proper value.
kruuger

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: load acaddoc and acad lsp faster?
« Reply #2 on: July 12, 2011, 09:07:59 AM »
Many of your command calls within your 'big bad one' could be changed to using setvar, which would drastically increase time.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

butzers09silverado

  • Guest
Re: load acaddoc and acad lsp faster?
« Reply #3 on: July 12, 2011, 11:49:17 AM »
we've given up on the template settings because we work with a lot of drawings that are not created from our templates.... for various legit reasons.

so can I just replace "command" with "setvar"?

ronjonp

  • Needs a day job
  • Posts: 7526
Re: load acaddoc and acad lsp faster?
« Reply #4 on: July 12, 2011, 11:54:43 AM »
See if this will help you out. Construct a list with variable name and value:

Code: [Select]
(defun setvars (/ lst x ds)
  (and (zerop (setq ds (getvar 'dimscale))) (setq ds 1))
  (setq lst '((acadlspasdoc . 1)
      (blipmode . 0)
      (cecolor . "bylayer")
      (celtscale . 1)
      (celtype . "bylayer")
      (cmddia . 1)
      (startup . 1)
      (textfill . 1)
      (textqlty . 100)
      (textsize . (* ds 0.125))
     )
  )
  (foreach x lst (vl-catch-all-apply 'setvar (list (car x) (eval (cdr x)))))
  (princ)
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: load acaddoc and acad lsp faster?
« Reply #5 on: July 12, 2011, 11:59:42 AM »
Switch your dotted pair list to a normal list and you won't have to break up your list.

Code: [Select]
(foreach item '( ("cmdecho" 0) ("insunits" 0)) (vl-catch-all-apply 'setvar item))
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

butzers09silverado

  • Guest
Re: load acaddoc and acad lsp faster?
« Reply #6 on: July 12, 2011, 12:06:08 PM »
ok, i understand what you're doing here logically, I don't understand how alan's fixes ronjonp's.  It appears that alan is replacing the "for each" line at the bottom.

All i have to do is figure out how to list all the variables right?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load acaddoc and acad lsp faster?
« Reply #7 on: July 12, 2011, 12:44:48 PM »
Switch your dotted pair list to a normal list and you won't have to break up your list.

Code: [Select]
(foreach item '( ("cmdecho" 0) ("insunits" 0)) (vl-catch-all-apply 'setvar item))

semantically I agree with you but with with no "eval section" you're breaking ron's code

just sayin'

:whistle:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: load acaddoc and acad lsp faster?
« Reply #8 on: July 12, 2011, 12:47:24 PM »
I don't understand how alan's fixes ronjonp's.

Since the vl-catch-all-apply function requires a list of arguments (not dotted pairs), Alan constructs each item in the list as a list of the required arguments for the setvar function.

Whereas, since Ron uses dotted pairs for each item, each sublist needs to be 'deconstructed' into the two arguments for setvar, then reconstructed into a list using the list function.

Lee

ronjonp

  • Needs a day job
  • Posts: 7526
Re: load acaddoc and acad lsp faster?
« Reply #9 on: July 12, 2011, 12:48:36 PM »
Switch your dotted pair list to a normal list and you won't have to break up your list.

Code: [Select]
(foreach item '( ("cmdecho" 0) ("insunits" 0)) (vl-catch-all-apply 'setvar item))

semantically I agree with you but with with no "eval section" you're breaking ron's code

just sayin'

:whistle:

That's why I had the (eval (cdr x)) to account for (textsize . (* ds 0.125)) ... but if you're going with straight values I'd shorten it to Alan's suggestion. :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: load acaddoc and acad lsp faster?
« Reply #10 on: July 12, 2011, 12:53:18 PM »
To satisfy both sides  :-P

Code: [Select]
(foreach item '(("cmdecho" 0) ("insunits" 0) ("textsize" (* ds 0.125)))
  (vl-catch-all-apply 'setvar (mapcar 'eval item))
)

butzers09silverado

  • Guest
Re: load acaddoc and acad lsp faster?
« Reply #11 on: July 12, 2011, 01:02:55 PM »
Thank you for the explanation, very helpful.  I'll give a go and see what happens tomorrow morning before everyone gets here  :kewl:

thanks again (for now, lol)

ronjonp

  • Needs a day job
  • Posts: 7526
Re: load acaddoc and acad lsp faster?
« Reply #12 on: July 12, 2011, 01:03:43 PM »
ok, i understand what you're doing here logically, I don't understand how alan's fixes ronjonp's.  It appears that alan is replacing the "for each" line at the bottom.

All i have to do is figure out how to list all the variables right?

Ok back to the regularly scheduled program  :-D

Yes ... just lookup the variables you want to change and add them to the list. My solution should work albeit not pretty to some  :-D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

butzers09silverado

  • Guest
Re: load acaddoc and acad lsp faster?
« Reply #13 on: July 12, 2011, 01:12:50 PM »
I understand yours ronjonp, i just can't figure out how alan changed yours... i mean i understand it but understanding it and turning it into functioning code, well, you know.

anyways, I'll use yours ronjonp because i can see how to insert the variables.  Will this allow me to combine acad and acaddoc into 1 routine?

thanks.

ronjonp

  • Needs a day job
  • Posts: 7526
Re: load acaddoc and acad lsp faster?
« Reply #14 on: July 12, 2011, 01:19:10 PM »
It should combine most of it. Like Alan said ... try to reduce your command calls to speed it up.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC