+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Oct 2009
    Posts
    22

    Default autolisp var to VBA text box?

    Registered forum members do not see this ad.

    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)


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

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    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,

  3. #3
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    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:
    Code:
    (setq USERS1 “TransferedString”)
    VBA:
    Code:
    ThisDrawing.GetVariable "USERS1"
    Regards,

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,986

    Default

    You may also take a look on that: http://autolisp-exchange.com/Forums/Forum6/F6T7P1.htm.

    Regards,

  5. #5
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    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.

  6. #6
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Oct 2009
    Posts
    22

    Default

    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!

  7. #7
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Registered forum members do not see this ad.


Similar Threads

  1. AutoLISP to convert text to block
    By Stephen Shafer in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 26th May 2011, 11:12 am
  2. need of autolisp
    By ChirilaDan in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 11th Feb 2010, 09:43 pm
  3. AutoLISP
    By J_Melcher in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 18th Nov 2008, 01:55 pm
  4. Autolisp
    By fiesta26 in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 6th Jul 2006, 11:52 am
  5. Linking text box to attribute value (AutoLISP, VBA or...?)
    By scootermac in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 27th Sep 2005, 12:35 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts