Pure newb need help!

Pure newb need help!

mcorriveau
Advocate Advocate
258 Views
2 Replies
Message 1 of 3

Pure newb need help!

mcorriveau
Advocate
Advocate
Hi everyone!

My boss asked me to create new command from a custom script that we already have and paid 50.000$ this is really huge and i have no knowledge of VB i only did some basic macro command for him, now he think i'm a coder.

Anyway i told him i will give a try.
Basicly the main menu call a window where we set parameter for quotation.
eg: text height, size, layer etc...
he want me to create new button that will automaticly set the setting for each button
eg: button 1
call the quotation command with size=2" height=7.5
button 2
call the quotation command with size=4" height=7.5
etc...
actually i managed to replace the "get info from forms" of some variable by my custom number.

but im stuck at;
CodeLigne = 1¼"
how do i set this size?

my next step will be to create a new sub for every constant i want to create since i have no idea how to set a VB variable from LISP

thanks for the help!
0 Likes
259 Views
2 Replies
Replies (2)
Message 2 of 3

mcorriveau
Advocate
Advocate
i will post a bit of the code i'm trying to edit;

Sub LigneCommentee()
On Error GoTo errorMaster
Dim tmpvar As String
tmpvar = ThisDrawing.GetVariable("Users1")

Layercode = GetSetting(appname:="Company", section:="Configuration", Key:="Ligne Layer code", Default:="") 'setting:=Layercode
LayerLigne = GetSetting(appname:="Company", section:="Configuration", Key:="Ligne Layer Ligne", Default:="") 'setting:=LayerLigne
LayerLongueur = GetSetting(appname:="Company", section:="Configuration", Key:="Ligne Layer Longueur", Default:="") 'setting:=LayerLongueur
Espacement = GetSetting(appname:="Company", section:="Configuration", Key:="Ligne Espacement", Default:="") 'setting:=Espacement
CodeLigne = Chr(188) 'setting:=CodeLigne
hauteur = 7.5 'setting:=hauteur
AffCentree = IIf(GetSetting(appname:="Company", section:="Configuration", Key:="Ligne Aff Centree", Default:="True") = "True", True, False) 'setting:=AffCentree
BoxHauteur = GetSetting(appname:="Company", section:="Configuration", Key:="Ligne Box Hauteur", Default:="") 'setting:=BoxHauteur
TxtBlockID = GetSetting(appname:="Company", section:="Configuration", Key:="Ligne ID", Default:="") 'setting:=BoxHauteur

----------------------------------
Here's what i want to customize.
CodeLigne = Chr(188) 'setting:=CodeLigne
hauteur = 7.5 'setting:=hauteur

and i call this sub from a lisp like this;

(defun c:lcr ()
(setvar "filedia" 0) ; disable all file dialog boxes
(setvar "filedia" 1) ; enable all file dialog boxes
(command "_-vbarun" " Royaltech.dvb!LigneCommentee") (princ) ; finish clean
) ; c:mnr = Menu

is it possible to create multiple fuction like
(defun c:lcr1 ()
(defun c:lcr2 ()
(defun c:lcr3 ()

and each will set different value in my .dvb file at these two variable
CodeLigne = Chr(188) 'setting:=CodeLigne
hauteur = 7.5 'setting:=hauteur

something like;

(defun c:lcr1 ()
(setvar "filedia" 0)
(setvar "filedia" 1)
(command "_-vbarun" " Royaltech.dvb!LigneCommentee" CodeLigne = 1½) (princ)
)

(defun c:lcr2 ()
(setvar "filedia" 0)
(setvar "filedia" 1)
(command "_-vbarun" " Royaltech.dvb!LigneCommentee" CodeLigne = 1¼) (princ)
)

Thank you for taking the time to read.
0 Likes
Message 3 of 3

Anonymous
Not applicable
The block of "GetSetting" statements you show is only retrieving defaults
from the system registry. They were probably put there by the compliment
"SaveSetting". This section doesn't say much about what the VBA program is
doing. If you find the "SaveSetting" function(s) it should be obvious what
you need to do to change defaults.

The following statement is taking a value out of the Acad system variable
"Users1"
tmpvar = ThisDrawing.GetVariable("Users1")

The lisp code is passing something to the VBA through "Users1" (a string
variable reserved for the user's use)

I'm not certain of what that is, but you could change it as you suggest like
so:

(defun c:lcr1 ()
(setvar "filedia" 0)
(setvar "filedia" 1)

(SETVAR "USERS1" "String value 1")

(command "_-vbarun" " Royaltech.dvb!LigneCommentee" CodeLigne = 1½) (princ)
)

(defun c:lcr2 ()
(setvar "filedia" 0)
(setvar "filedia" 1)

(SETVAR "USERS1" "String value 2")

(command "_-vbarun" " Royaltech.dvb!LigneCommentee" CodeLigne = 1½) (princ)
)

Try to find the VBA sub that is doing the work. We will be able to help you
more if we can see what it is doing. It may be taking more values from the
Acad user variables. There are 5 string, 5 integer, and 5 floating point
sysvars available. It could be using all of them.

Hope this helps.

Gary
0 Likes