Code debugging

Code debugging

support201
Contributor Contributor
1,934 Views
16 Replies
Message 1 of 17

Code debugging

support201
Contributor
Contributor

Dear all,
My customer is using add-on AutoLISP for AutoCAD. He made a code of AutoLISP inorder to export the table of Point Coordinates, but the output value after exporting is incorrect. For detail, the problem is that when he run Autolisp, the X coordinates of the output points were negative coordinates instead of positive as they should be . Additionally, the coỏrdinate origin moved to another position. Kindly see the attachment for more details
Please help me to fix the code of AutoLISP
Thanks so much
Duc Tran

0 Likes
1,935 Views
16 Replies
Replies (16)
Message 2 of 17

ВeekeeCZ
Consultant
Consultant

Do I understand you correctly that you are providing some purchased services and the actual work you're using from us?

0 Likes
Message 3 of 17

support201
Contributor
Contributor

My customer. Yes, my customer has purchased AutoCAD, and he use AutoLISP for AutoCAD, and now he need your help to debug his code of AutoLISP

0 Likes
Message 4 of 17

devitg
Advisor
Advisor

Why not use DATAEXTRACTION . 

Please show the dwg before the lisp was  applied

0 Likes
Message 5 of 17

support201
Contributor
Contributor

Hello Devitd,

I would like to provide the drawing before running LISP, pls see the attachment

When I use Dataextraction, there is a problem that when I export the table of coordinates inorder to manufacture there is no coordinate in the table

0 Likes
Message 6 of 17

devitg
Advisor
Advisor

Find attached both the dwg  with  table and Xls , also the CIRCLE DATA.dxe to be used when Data extraction dialog box ask 

 

 

 

 

 

0 Likes
Message 7 of 17

devitg
Advisor
Advisor

attached

0 Likes
Message 8 of 17

support201
Contributor
Contributor

Hello Devitg,

Thank you so much for your help. But I am afraid that the result is not correct. There are 2 points which their X coordinates should be 0. Kindly see the attachment

0 Likes
Message 9 of 17

devitg
Advisor
Advisor

It seem to be the fact is your UCS. set it to World 

checking

 

 

0 Likes
Message 10 of 17

devitg
Advisor
Advisor

I did check it , if I set UCS to world , and move all circles from the left-down-most, to 000 , and a set a new dxe , it work as expected . find attached 

 

 

0 Likes
Message 11 of 17

devitg
Advisor
Advisor

attached 

0 Likes
Message 12 of 17

support201
Contributor
Contributor

Hello Devitg. thank you so much. the result is correct. But I need to debug my code in AutoLISP. Because I want to use AutoLISP to do not only exporting coordinates but also the other things. So could you please help me to find the issue in my code?

0 Likes
Message 13 of 17

cadffm
Consultant
Consultant

There is no issue, but alle data are stored in the one and only WCS.

If you read the object data -> WCS!

UCS are for the User only, as help for a better workflow with less calculatings for the user (but more for the program).

 

If you like to know what the coordinate are in UCS system, Press Help [F1] and read about TRANS (LispFunction)

(trans (cdr(assoc 10 (setq el (entget(setq en (car(entsel))))))) en 1)

Sebastian

0 Likes
Message 14 of 17

support201
Contributor
Contributor

Thanks so much. I tried to change the code from 0 to 1 but it failed. What should I do? Kindly see the attachments

0 Likes
Message 15 of 17

cadffm
Consultant
Consultant

@support201  schrieb:

Thanks so much. I tried to change the code from 0 to 1 but it failed. What should I do? Kindly see the attachments


I don't understand what your post have to do with my answer!?

You new Table looks good except you changed "my setting" from OCS to ??? perhaps to WCS,

i don't know - you didn't post the used new code here.

 

The problem is: "We" know how Acad works, also Lispfunctions, but we don't know about your AutoCAD and Lisp knowledge,

so it is difficult to answer in the best way for you.

 

Sorry, i am out.

It take too many time to teach all stuff from scratch (WorldCoordinateSystem WCS, User(defined)CoordinateSystem UCS, and for programming - Object coordinate system OCS / DXF 210)

 

If your wanted coordinate system is active, like in your sample file,

 you can use me TRANS setting to convert Circle-Center coordinates from OCS to UCS data.

 

I don't test your code, because you uses commands and didn't internationalized it,

Text prompt are not in english, so it is hard to follow the steps for a successfull input.

(I start CTC, what i have to type in to get the same result like you? CTC,16,2,A1,E(?),PickPoint(?),a Number(?),ObjectSelection(?), H(?) -> not working for example)

Try this to set the PNTS variable:

(setq pnts (append pnts (list (trans (cdr (assoc 10 (entget (ssname rfob n)))) (ssname rfob n) 1))))

 

 

 

 

Sebastian

0 Likes
Message 16 of 17

devitg
Advisor
Advisor
to do not only exporting coordinates but also the other things

 

Please clear what other thing , and try to translate from VN to EN  quoted text at  the LSP file 

 

0 Likes
Message 17 of 17

support201
Contributor
Contributor

I attached the code in English, pls see the attachments

0 Likes