TheSwamp
Code Red => VB(A) => Topic started by: Matersammichman on May 23, 2006, 05:32:04 PM
-
When you open CAD, ACADProject(Global1) is opened.
I'd like to have CAD load a dvb on startup, so I'm thinking I may want to edit "whatever" brings this up.
Suggestions? :pissed:
-
well, that is an interesting question b/c there are a number of things you could edit to load dvb files. What are you familiar with editing? You could create a LISP file that loads DVB files, or put them in your Startup Suite (I wouldn't, but you could).
-
(I wouldn't, but you could).
I disagree with Mr. Duh on that one. If you want them loaded at startup, especially if they're going to be running in the background, I see no reason at all not to put them in the startup suite. You can also use an ACAD.DVB as an automatically loaded loader.
-
I dont use the suite b/c sometimes it freaks out and doesn't load things. I do use it for some things, but I use the MNL file to load our routines. I also have a loader function in LISP that checks for the function and loads the dvb if necessary when you call the routine
-
.... but I use the MNL file to load our routines. I also have a loader function in LISP that checks for the function and loads the dvb if necessary when you call the routine
yep ... that way the Partial menu controls what is loaded via the MNL .. works for me.
-
Agree that there's no reason to load them until needed and the loader lisp is great for that, I have two VBA programs that run in the background constantly. I've never had a problem with the startup suite freaking or at least have never noticed it.
-
me either, but I have seen complaints in threads here. (I cant think of where I saw it, just making note of it)
-
There is normally no need to preload a VBA module...
In a menu macro type:
-VBARUN;MyApp.dvb!MacroFunctions.MyFunction
The MyApp.dvb file is loaded and the macro is executed. The MyApp.dvb file remains loaded once the macro has been completed.
The dvb module must be in a path of the AutoCAD environment, else you've to specify the full path in the call.
-
It all depends on WHEN you want the startup code to be run.
Adding it into the startup suite/mnl etc. is almost in the last stages of the Acad load process and you will also take the hit of the acadvba/acvba.arx loading at that time.
The absolute best way is to toss an "acad.rx" file into your search path and in that put a line "acadvba.arx" or "acvba.arx" - depends on the version of acad you're running.
This makes sure the VBA interpreter arx is loaded with all the other startup arx files.
You then put an "Acad.dvb" file in the search path - this is vba's equivalent of acad.lsp...it will autoload. If you then want something to execute at startup from Acad.dvb, put a public sub called AcadStartup into a public module and any code in that will be executed when acad starts.
This method will make sure you stuff runs BEFORE any associated lisp/startup suite stuff...all depends on what you want (read - this is the way I ALWAYS do it).
Cheers,
Glenn.
-
Thats what I do ^ . And it works really well
-
"Why" I want to do this...
I have to take a dvb file and place it on every computer in the workplace.
Our CAD systems are pathed to one global folder for "common" files.
If I can hardcode something that loads from a globally accessed common file on every computer, it will prevent me from having to go to every workstation and add the dvb file into the Startup Suite.
Comments? :lol:
-
I would make it acad.dvb, put it in that folder, and it will load from every machine
-
One word of caution on shared DVBs. A DVB, unlike a LSP, when loaded is locked. Everyone can use it at the same time but it cannot be modified, replaced, etc. until it is closed on all machines. Depending on how many seats you have it could be a hassle.
-
I agree 100% with Bob, as I deal with this all the time. I keep a separate set of dvb files for editing, and have an update routine that copies them to the server at night when noone is using the network versions
-
I also read you can't run more than 20 cads using the same vba due to a bug. Ouch.
-
Maybe you can overcome that by placing multiple instances of the same macro in the common folder, using different file names. If an error occurs due to more than 20 users, you could trap the error and present the 21st-etc. user the/an other instance.
-
My preference is still to copy them locally.
-
Is that automated Bob or one at a time.
-
...you could write a small executable that is run on workstation startup, copies ererything it finds in a certain central network folder to a certain local folder (and ruthlessly overwrites if necessairy) so the newest versions of your macro's are always available locally. Not very elegant maybe, but effective.
-
Batch file, even more better/easier than an executable.
Bryco, automated is the way to go as a general rule IMO. That being said, at this time, in this place, I have a small number of people to support and not a very high frequency of changes so I haven't set up an automated system.
-
Who remembers the DOS commands nowadays...?
OK, start a new txt file and paste this code in it, with appropriate source and target drives\directories.
Rename the saved txt file to e.g. COPY-DVB.BAT (indeed a batch file)
Install COPY-DVB.BAT on all Acad workstations, create a shortcut to it and drop this shortcut in their START menu, under PROGRAMS - STARTUP. In the shortcut properties, you can even specify that you want the BAT file to run in a minimized DOS window.
@ECHO OFF
REM this means the commands will not be echoed on screen
COPY /Y /B YourSourcePath\*.DVB YourTargetPath
REM that's all...
REM /Y means no confirmation dialogs (silent mode)
REM /B means you want to copy binary (not ASCII) files
REM If you want to copy other types of files, you can
REM repeat COPY likewise, with other file extensions.
REM COPY *.* (all wildcards) doesn't work in silent mode
My DOS knowledge has also become a bit rusty, but I think this should work.
(Of course, you can also put COPY-DVB.BAT in a central network drive\directory and let the local shortcut in START-PROGRAMS-STARTUP point to that.)
-
good idea. I like the KISS principle, yet able to update daily w/o causing problems