Jump to content

Recommended Posts

Posted

I really hope someone can help me here because I am at my wits end here.

 

I have a program that I am working on, which I tried to do complete in just VBA, which was a failed attempt; but I can do it in LISP, so I am using the VBA to LISP techniques. The only problem it looks like you can only pass pre-defined AutoCAD variables between VBA and LISP (i.e USERS1, USERS2, USERS3, USERS4, USERS5). Is this correct?

 

Anyways, to get to my question I need to pass many file names (as strings) to LISP, a lot more than the 5 user fields allow and because of the restrictions on variable names erasing after the module closes I have to get them all out at one shot.

 

I thought this code below would work; but I forgot the "Getvar" LISP command requires quotes which confuses the VBA SendCommand.

 

[color=black]   ThisDrawing.SetVariable "USERS1", ProcessList.List(0)[/color]
[color=black]   ThisDrawing.SendCommand "(setq UserList (getvar "USERS1"))"[/color]
[color=black]   For i = ProcessList.ListCount - 2 To step - 1[/color]
[color=black]       ThisDrawing.SetVariable "USERS1", ProcessList.List(i)[/color]
[color=black]       ThisDrawing.SendCommand "(setq UserList (cons (getvar "USERS1") UserList))"[/color]
[color=black]       Next i[/color]

 

Anyways, this is probably not the best way to do it; but like I said I am at my wits end here. Does anyone have any way to make this work?

 

ProcessList = List Box

 

I hope I have provided enough information.

 

Thanks in advance.

Posted

Olhado,

I don't have a complete answer for you, but for extra user variables there are at least two ways. You can set environment variables in Windows. I have not done this myself, but I have heard that it can be done. I don't know how much space is available for user variables in the environment. Maybe someone on the forum can give specifics. You can also open a text file in Autolisp, write and read anything you want, then delete or keep the file as you wish. I have done that many times and it works well. Hope this helps.

Posted

Oh by the way remember to close the file else you will get a read error.

Posted

Dictionaries is the best way of AutoLISP VBA interchange.

Posted

How to put data from autocad' objects to excel. for example values of text into excel table!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...