suns_444 Posted July 6, 2012 Posted July 6, 2012 Hello!, I want to write a VB 6.0 program to open AutoCad application & a new drawing. I have a AutoLisp / visualLisp routine already written for drawing generation. I want to know the VB 6.0 code to run the AutoLisp / visualLisp routine in AutoCad to generate the drawing. from the inputs given in userfrom by the user Can please anyone help? Regards, Sunny Dedhia Quote
MSasu Posted July 6, 2012 Posted July 6, 2012 You will need to use the SendCommand method: ThisDrawing.SendCommand "(load " & Chr(34) & "C:\\test.lsp" & Chr(34) & ") " But there is an issue - the VB will not notice that AutoLISP code's execution is done, so need a workaround to wait until resume his own code. There was a previous discussion on this mater; I will try to locate it for you. Quote
suns_444 Posted July 6, 2012 Author Posted July 6, 2012 Thank you Hi Mircea, could you please elaborate on what exactly you want to convey the code you gave its a vb6.0 code please just elaborate on how do want me to use it regards Sunny Dedhia Quote
MSasu Posted July 6, 2012 Posted July 6, 2012 It is Visual Basic 6 code since you stated this version in your first post. That code will just load an AutoLISP routine into current drawing - you may call it by another SendCommand call or simply by calling at the end of said LSP file. To use it just replace the example path with yours. Quote
suns_444 Posted July 7, 2012 Author Posted July 7, 2012 Hi Mircea, thank you for the explanation before you were talking about another thread if have found it please let me know I am also going to pass variables values from VB6 user form to AutoLISP to create drawing and then after drawing is created the area back to VB6.0 user form and as i said in my first post i also need VB 6.0 code to open Autocad and a new drawing if you could please help me on that as well and thanks alot for your help :thumbsup: Regards Sunny Dedhia Quote
MSasu Posted July 7, 2012 Posted July 7, 2012 you were talking about another thread if have found it please let me know I didn't located that discusion yet, I will try again later; a detail that I remember for sure is that the solution was sugested by the moderator Fuccaro. I am also going to pass variables values from VB6 user form to AutoLISP to create drawing For that you may either use a temporary file or create and call an AutoLISP function with arguments: ThisDrawing.SendCommand "(load " & Chr(34) & "C:\\MyLISPFile.lsp" & Chr(34) & ") " ThisDrawing.SendCommand "(MyFunction " & (CStr Param1st) & " " & (CStr Param2nd) & ") " after drawing is created the area back to VB6.0 user form I presume that you were looking to transfer a result from processing in AutoCAD to the Visual Basic form. For this should use either a temporary file again or one of AutoCAD's user defined system variables. i also need VB 6.0 code to open Autocad and a new drawing This was covered many times before - please do a search on the Forum. Quote
suns_444 Posted July 7, 2012 Author Posted July 7, 2012 can you please tell me what do mean by creating temporary file i am going to pass 11 variables from VB 6.0 user form to Autolisp to create drawing and then 5 variables which will calculate area in autolisp these 5 variables to VB6.0 user form to to display because i am then going to pass all these details in VB6.0 user form to be converted to excel file for users to print out regards Sunny Dedhia Quote
MSasu Posted July 7, 2012 Posted July 7, 2012 can you please tell me what do mean by creating temporary file A temporary file is a file created in TEMP folder of the system; is a preferred solution since is quiet. To find this folder in AutoLISP: (getvar "TEMPPREFIX") Respectively in Visual Basic: Environ$("temp") Environ$("tmp") 5 variables which will calculate area in autolisp these 5 variables to VB6.0 user form to to display You are allowed to define up to 5 user system variables to store real values USERR1 to USERR5; for more can convert them to strings and concatenate to a single strings using tabs; for the last case use USERS1 for transfer. Quote
MSasu Posted July 7, 2012 Posted July 7, 2012 before you were talking about another thread if have found it please let me know Here it is; sorry for the delay. Quote
Recommended Posts
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.