Load & Run DVB File

Load & Run DVB File

Anonymous
Not applicable
12,460 Views
7 Replies
Message 1 of 8

Load & Run DVB File

Anonymous
Not applicable

How to automatically run dvb file when acad starts, I have been trying the help in autocad but its not working.

I am using ACAD 2007

0 Likes
Accepted solutions (1)
12,461 Views
7 Replies
Replies (7)
Message 2 of 8

Amremad
Collaborator
Collaborator

Make file with ext. lsp lik --- VBA.LSP

then write in it

 

(defun c:tst ()    ( vl-vbarun  "Path/DVB.dvb!Testing.test" ))

 

witch

 

tst = the command you will use it to call it form autocad

path/dvb.dvb = the path your dvb file

 

tsesting = your medule

test = your function or sub

 

then make your this lisp load automaticlly from autocad

0 Likes
Message 3 of 8

Anonymous
Not applicable

你可以在2012开发人员帮助里面找到帮助。

You can find help in the developer's help of CAD2012.

我建议你用以下的方式,也就是帮助中提到的方式来写这个Lsp文件。

I suggest you to use the following style refered in the help of CAD2012 to write your lisp file.

这样能避免不同VBA工程之间的冲突。

This way can  avoid the confict of the difination for sub name from different  project.

My english is not good, you can translate the chinese by some translate tools.

;;字符统计(可获取属性块内文字)-------------001
(defun C:GT()
 (command "_-vbarun" "Lrygettext")
)

;;批量打印(应用PLM excel)------------------002
(defun C:BV()
 (command "_-vbarun" "LryBatchexcel")
)

;;按位置获取CAD中文字表格(自制表格)-------003
(defun C:TL()
 (command "_-vbarun" "LryTl")
)

;;获取CAD中文字(不按图形位置)-------------004
(defun C:Q3()
 (command "_-vbarun" " LryQ2")
)

;;阵列数字----------------------------------005
(defun C:CN()
 (command "_-vbarun" "LryCN")
)

0 Likes
Message 4 of 8

Anonymous
Not applicable

As mentioned by you , I created a file vba.lsp ,with the following code

 

(defun c:tst() (vl-vbarun "c:/Documents and Settings/user455/Desktop/test.dvb!Module1.AcadStartup"))

 

my dvb filename is test

sub Name is Acadstartup

 

I have also used appload to refer test.dvb at startup in Autocad,but it doesn't help.

Pls suggest what should be done ?

0 Likes
Message 5 of 8

andrewpuller3811
Advisor
Advisor
Accepted solution

Find your acad.lsp file.

 

It will be in one of the support folders ending with support listed in the Support File Search Path of the Files tab in Autocad's Options dialogue. Or you can do a file search and confirm the location against the paths listed in autocads options dialogue.

 

If an acad.lsp file does not exist create one in notepad, and save it to a support path location.

 

Once you have your acad.lsp file, add this. Don't worry about the vba.lsp file, this will load and run your dvb on autocad start up. Every time autocad is started it looks for and loads the first acad.lsp file it finds (then acaddoc.lsp). Be aware, putting this in the acad.lsp file, may cause the macro to run before there is a document loaded. If that is the case, put it in the acaddoc.lsp file, which loads every time a document is created or opened.

 

(if  

   (findfile    

        " c:/Documents and Settings/user455/Desktop/test.dvb"

   )

    (progn

             (vl-load-com)

             (vl-vbarun "c:/Documents and Settings/user455/Desktop/test.dvb!Module1.AcadStar​tup")

    )

  (princ)

 )

 

 

This does not create a command that you can run from autocad, as the previously defined vba.lsp file does, it just loads and runs the dvb file and macro.



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
Message 6 of 8

Anonymous
Not applicable

just put the dvb file in the start group of CAD.and then put the lsp file in too. I don't think there will be any problem.

 

(defun C:BV()
 (command "_-vbarun" "LryBatchexcel")
)

You must  pay attention to the "_-vbarun" .

0 Likes
Message 7 of 8

Anonymous
Not applicable

It worked    Smiley Very Happy

Thanks a lot .

 

One thing that I would like to mention, since I installed AutoCad from Autocad Mechanical Suite, so this code needed  to be added in acad.lsp file at following path

C:\Documents and Settings\user455\Application Data\Autodesk\AutoCAD Mechanical 2007\R17.0\enu\Support

 

instead of 

 

C:\Documents and Settings\user455\Application Data\Autodesk\AutoCAD 2007\R17.0\enu\Support

 

Thanks again

 

Deepak

 

 

 

 

 

0 Likes
Message 8 of 8

Anonymous
Not applicable

Hello,

 

If you are creating a toolbox from customization dialog box, you create a .cui file and you can use the code below in the 'Macro' input of properties in customization dialog box:

 

^C^C_FILEDIA;0;(vl-vbaload  "E:/Programs/Cut-Fill.dvb");(vl-vbarun "Module1.LoadCutFillApp");

 

Good luck,

 

Mohsen

0 Likes