You can save answers into a drawing for future using userr1 -4 (real) useri1 -4 integer users1 -4 strings
Just getvar userr1 etc but if some else does this also can screw up things.
This is simple I am sure there is a way


Registered forum members do not see this ad.
Has anyone ever passed a Lisp variable into VBA and vice versa, sent a variable to ACAD from VBA?
M




You can save answers into a drawing for future using userr1 -4 (real) useri1 -4 integer users1 -4 strings
Just getvar userr1 etc but if some else does this also can screw up things.
This is simple I am sure there is a way


Hi Big
Yeah, there was this real long VLAX.cls module out there.
I muffled threw it some months ago and narrowed it down to two functions; they are GetLispSym and PutLispSym
It really works well for string variables and integers.
I don't use it a whole lot but on occasion, I may do something like (setq myvariable "whatever" ) in the mns/cui then in VBA, I may grab that variable if I need to do something.
On the flip side, I may do something in VBA and fr some reason want the variable available in my CAD session, even after the VBA module is finished running, so I will then use PutLispSym
I don't get too carried away with that stuff but it works well if I need it.
I have also heard of users but I don't really like it, it is a bit limited.
If you'd like to see the code, let me know
Mark
Hi All
that sound is good
there is a VBA file wants to be a lisp
how is this plz
Thanx



At first, thanx for quick replying
Yes i have a VBA file want to convert to lisp
Please find attached
thanx
Something like:
Code:(defun c:ftxt(/ tObj dfxC tSet cPt tVal tStr vPt actDoc layCol nLay cTxt mSp cObj) (vl-load-com) (if(and(setq tObj(entsel "\nSelect text > ")) (member(cdr(assoc 0(setq dfxC(entget(car tObj))))) '("TEXT" "MTEXT")) (setq tVal(cdr(assoc 1 dfxC))) ); end and (if(and (setq tSet(ssget "_X"(list '(0 . "TEXT,MTEXT")(cons 1 tVal)))) (/= 1(sslength tSet)) ); end and (if(setq cPt(getpoint "\nSpecify point > ")) (progn (setq tStr(strcat tVal ", Qnty = " (itoa(sslength tSet))) actDoc(vla-get-ActiveDocument(vlax-get-acad-object)) layCol(vla-get-Layers actDoc) ); end setq (if(= 1(vla-get-ActiveSpace actDoc)) (setq mSp(vla-get-ModelSpace actDoc)) (setq mSp(vla-get-PaperSpace actDoc)) ); end if (setq cTxt(vla-AddText mSp tStr(setq vPt(vlax-3D-point cPt)) (vla-get-Height(vlax-ename->vla-object(car tObj))))) (if(not(vl-catch-all-error-p (setq nLay(vl-catch-all-apply 'vla-Add (list layCol "Qnty text"))))) (vla-put-Color nLay acBlue)) (foreach txt(mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex tSet)))) (if(= acAlignmentLeft(vla-get-Alignment txt)) (setq cObj(vla-AddLine mSp vPt(vla-get-InsertionPoint txt))) (setq cObj(vla-AddLine mSp vPt(vla-get-TextAlignmentPoint txt))) ); end if (vla-put-Layer cObj "Qnty text") (vla-put-Layer cTxt "Qnty text") ); end foreach ); end progn (princ "\nCommand canceled! ") ); end if (princ "\nNothing found! ") ); end if (princ "\nIt isn't Text or MText! ") ); end if (princ) ); end of c:ftxt


Hey Guys
AS, I am not too familiar with VLISP so I am not exactly sure what your code does. I am curious to know though
The code I have is 2 functions that will allow you to grab a LISP (String or Integer) variables and use them in VBA
and vice versa, it will allow you to send (String and Integer) variables also from VBA to LISP.
So, for instance, if you ran your LISP routine first then the VBA module after that, the vba module can use the lisp variables and if you run your vba module first, you can then use the variables from VBA at the command line in ACAD or in a LISP routine.
If you guys are interested, I will have to dig it up, then I will post it later. I think I have a few simple examples I can post too.
If I can figure out how, I will post the whole project
M
What a quick reply
That lisp is good
But may I post some comments
Plz find attached
Thanx
HaSaN
Registered forum members do not see this ad.
>ML0940
Look to code for VBA<-> VisualLISP interchange:
http://ww3.cad.de/foren/ubb/Forum259/HTML/000399.shtml
> asos2000
Not today.
Bookmarks