Jump to content

autolisp var to VBA text box?


mojo8997

Recommended Posts

Hey guys, im getting better at lisp but now i also want to dig into a little vba also, i hear its helpful to learn both if possible, i have a lsp that sets a var and i want it to show up in a vba text box i tried this but its not working, thanks for any advice in advance!

 

(testing does a (setq testing 12345)

 

 

 
Private Sub UserForm_Initialize()
ThisDrawing.SendCommand "testing" & vbCr
TextBox1.Text = ThisDrawing.GetVariable("test")

End Sub

Link to comment
Share on other sites

First, GetVariable statement is used to list the value of system variable, that it built-in variables that control drawing environment. So, cannot be used to list a user defined AutoLISP variable.

 

Second, since just getting started, maybe is better to consider the .Net customization approach; this is due to the fact that the VBA technology is dropped by both Microsoft and Autodesk. See:

http://www.cadtutor.net/forum/showthread.php?t=33211

http://www.cadtutor.net/forum/showthread.php?t=34389

http://www.cadtutor.net/forum/showthread.php?t=40154

http://www.cadtutor.net/forum/showthread.php?t=41247

http://www.cadtutor.net/forum/showthread.php?t=42385

 

Regards,

Link to comment
Share on other sites

To get that AutoLISP – VBA communication done may try to use the user system variables USERI1-5, USERR1-5 and USERS1-5; but the quantity of data that can be transferred this way is limited.

 

AutoLISP:

(setq USERS1 “TransferedString”)

 

VBA:

ThisDrawing.GetVariable "USERS1"

 

Regards,

Link to comment
Share on other sites

You can save variables in the user?? these are basicly 15 variables 5 as Integer 5 as string 5 as a real its a good simple way if you only work in house it can have a problem if external software "ADD ONS" also change these values I was involved in some software and we took advantage of this and save various variables in these such as scale, thickness of walls etc

 

You can also write to the register and save a variable value but its only local on your pc, otherwise look into extended entities which get saved into the drawing.

Link to comment
Share on other sites

very cool, thanks for the info! let me see what i can come up with. I would like to learn .net because vba is being dropped, i guess i should start looking into it, thanks again!

Link to comment
Share on other sites

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...