dinahajjar Posted November 13, 2012 Share Posted November 13, 2012 Greetings, I am having a problem while running an autocad lisp on my computer (windows xp sp3) in autocad 2004. I tried running the lisp on another computer windows xp sp2, it worked perfectly. When I runned it on my computer it gave me the error: runtime error 13 type mismatch on the following line: Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points) is it related to the windows version? please help, Thanks, Dina Quote Link to comment Share on other sites More sharing options...
Tyke Posted November 14, 2012 Share Posted November 14, 2012 Dina you have a VBA macro here not a LSIP routine. How have you declared the variable plineObj, "Dim plineOBJ As ??????". I doubt if it is related to the Windows version. What version of AutoCAD is running on the other machine where the macro works. Quote Link to comment Share on other sites More sharing options...
dinahajjar Posted November 14, 2012 Author Share Posted November 14, 2012 Dina you have a VBA macro here not a LSIP routine. How have you declared the variable plineObj, "Dim plineOBJ As ??????". I doubt if it is related to the Windows version. What version of AutoCAD is running on the other machine where the macro works. ah yes sorry it's a macro. On the other machine it was also autocad 2004, and it worked perfectly. and yes it was declared: Dim plineObj As AcadPolyline Quote Link to comment Share on other sites More sharing options...
Tyke Posted November 15, 2012 Share Posted November 15, 2012 Set a breakpoint on the line where you get the error message, so that that line of code is not executed, and then look what is in your variable "points". There should be several sets of coordinates. Quote Link to comment Share on other sites More sharing options...
dinahajjar Posted November 16, 2012 Author Share Posted November 16, 2012 Set a breakpoint on the line where you get the error message, so that that line of code is not executed, and then look what is in your variable "points". There should be several sets of coordinates. there are some points with 0 coordinates. I think this is the problem, but the weird is that this problem is just happening on my computer. any ideas? Quote Link to comment Share on other sites More sharing options...
Tyke Posted November 16, 2012 Share Posted November 16, 2012 I've no idea why it works on one computer and not on another. Have you included any references other than the standard ones and if so are these references present on both computers? In you comment above the breakpoint line you say you want to create a LW Polyline, but your code is creating a 2D polyline and the 0 coordinates in "points" are the Z coordinates. In your code the 0 coordinates are not a problem and should work. If you want to create a LW Polyline use this code and ensure that the 0 Zcoordinates are not in "points", do that when you write your data to "points": Dim plineObj As AcadLWPolyline Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points) Quote Link to comment Share on other sites More sharing options...
Tyke Posted November 16, 2012 Share Posted November 16, 2012 I tested your code snippet and it all works fine. If you want you could PM me and I could look at your complete code. Quote Link to comment Share on other sites More sharing options...
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.