Jump to content

AutoCAD VBA runtime error 13 mismatch


dinahajjar

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Points.jpg

Link to comment
Share on other sites

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)

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