error bad argument type vla-object nil

error bad argument type vla-object nil

Anonymous
Not applicable
6,258 Views
9 Replies
Message 1 of 10

error bad argument type vla-object nil

Anonymous
Not applicable

Hello guys,

I'm using a lisp file to convert point blocks (block reference with attributes like PN, ZC, PD, etc) to COGO points. It worked well at first, but then it stopped working for the rest of the blocks. The error says "bad argument type, vla-object nil". The original author of the lisp didn't seem to be responding recently.  Some online sources say it's a global variable relevant to active document. I attempted to do that but failed. Can anyone help me out? Thanks. 

The attached are the lisp file and the autocad file with points. I'm using Civil 3D 2018.

0 Likes
Accepted solutions (1)
6,259 Views
9 Replies
Replies (9)
Message 2 of 10

rkmcswain
Mentor
Mentor
Have you tried closing Civil 3D and reopening it and trying again?
R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 10

Anonymous
Not applicable

Yes, I tried closing and reopening Civil 3D, the same error. I tried removing and reloading the lisp too, still the error. 

I did find a way to get around the error: I copied and pasted some point blocks to a new created cad file and was successful in converting them to COGO points. Then I copied and pasted the COGO points back. 

However, it would be easier if i don't have to do this copy paste thing.

0 Likes
Message 4 of 10

Anonymous
Not applicable

Well, I have to correct my previous reply. In the newly created cad file, the majority point blocks were converted to COGO points, but some point blocks didn't convert. I will have to copy those unconverted point blocks to another newly created cad file and repeat the procedure. Maybe after three times of this procedure, all blocks will be converted. This is very unstable. I won't call it a solution. lol

0 Likes
Message 5 of 10

Jeff_M
Consultant
Consultant
Accepted solution

@Anonymous, the tool is failing due to the NextPointNumber property of the dwg is equal to a PointNumber already in the drawing. Resetting this to 1, removing all of the previously created CogoPoints, and using the attached lisp that I wrote a few years ago for converting EaglePoint blocks to CogoPoints, I successfully converted all blocks in the drawing to CogoPoints. 

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 10

Anonymous
Not applicable

Thank you very much, Jeff! It worked. 

I didn't quiet follow when you said "Resetting this to 1", but I did remove previously created COGOPoints and then used your lisp. All points are converted this time. 

0 Likes
Message 7 of 10

Jeff_M
Consultant
Consultant

You're welcome. For future reference, sometimes C3D's NextPointNumber setting ends up being the same as an existing point in the drawing. It doesn't happen often, and really shouldn't ever occur but it does. This prevents new points from being created, both manually by the user and when a custom program attempts it in code. This is the setting I was referring to, which was 655 when I opened your test (2).dwg.

 

2018-11-29_12-18-55.png

Jeff_M, also a frequent Swamper
EESignature
Message 8 of 10

Anonymous
Not applicable

I see. That was odd. Now since you brought up that, I have a new question. After resetting "NextPointNumber" to 1, and using the lisp to convert the EaglePoint points to COGOPoints, the "NextPointNumber" became 1205. Why? I looked at the point group, the largest PointNumber is 689. Isn't the NextPointNumber supposed to be 690?

 

0 Likes
Message 9 of 10

Jeff_M
Consultant
Consultant
It likely has to do with the order of the points in the drawing. As the CogoPoints are created it assigns the point number from the block, C3D then sets the next point number to one higher if the current is less than the number. The tool could be modified to check that the next number is 1 more than the highest number in the dwg.
Jeff_M, also a frequent Swamper
EESignature
Message 10 of 10

LaGrecaMark
Observer
Observer

Hi. I was successful in using the lisp you wrote. But it removed the point description and replace it with the elevation. How can I prevent this?

 

Thanks,

Mark

0 Likes