Hey all,
I have a lisp that used to work just fine before. It gave me quick acreage of an area and was useful for reference.
I am on Civil 3D 2020, and it appears to be broken. It keeps giving me a value of "0". I opened up Visual Lisp to inspect. Lisp follows:
(defun c:AC ()
(SETQ IP (GETPOINT " Pick Internal Point: "))
(COMMAND "-BOUNDARY" ip "")
(SETQ SS (ENTLAST))
(PROGN (COMMAND "AREA" "o" SS))
(SETQ acres (/ (GETVAR "AREA") 43560))
(SETQ Acres (rndby acres 0.001))
(setq ktext (strcat (rtos acres 2 2)" AC" ))
(setq ht 5)
(command "_.text" ip ht "0" ktext)
(princ)
)
(defun rndby (r b / tmp)
(setq tmp (rem r b))
(cond ((>= tmp (* 0.5 b)) (+ r (- b tmp)))
(T (- r tmp))))
I am trying to find the error in my programming, or a lisp that can do what this one can. Attached is also the Lisp file for those that prefer to mess with it in VLisp.
Thanks
Edit: Accidently escalated the topic. Eitherway, anyone's input will be helpful.
Solved! Go to Solution.
Solved by user181. Go to Solution.
Hi @Anonymous ,
Can you please try the following attached Lisp below?
Original source of Lisp: Link
Cheers,
Jowenn
Jowenn Lua | Retired Account See My New Profile Here
AU 2023 CES600726 – Getting Started with Generative Design in Civil 3D: A Beginner’s Guide
AU 2020 CES473668 – Supercharge Your Dynamo Graph with Civil 3D Toolkit
AU 2019 CES319333 – Dynamo in Civil 3D Introduction Unlocking the mystery of scripting
AU 2018 CI225967 – Using Automation in Civil 3D for Construction Documentation and Exports
AU 2017 CI123653 – AutoCAD Civil 3D and Subassembly Composer— Real-World-Practice Tips and Tricks
Okay so I tried both LSP files. Both are doing the same thing as my LSP. It gives me a value of 0 when I click inside, no decimal spots or anything. I attempted to make a larger square and check to see if precision was the issue, and it was not. They all keep giving me 0.
Hi,
In your code, try changing the tolerance from 0.001 to 0.0001
(SETQ Acres (rndby acres 0.0001))
Can you please share test drawing, I would like understand the drawing environment.
Are the coordinates of your PLINE is very far from origin ?, is it pure C3D drawing ?
Good morning,
I have attached one of my sites, and the Lisp. Please let me know if anyone has ideas, thank you all!
It is not because of Civil 3D 2020. It is because the current text style has an assigned height and the routine is written assuming a height of 0 is set for the current text style.
Either set the current text style to one with a height of zero before running the lsp or change the line:
(command "_.text" ip ht "0" ktext) to (command "_.text" ip "0" ktext) to use a style with a height assigned.
Or modify the lisp to set a current text style and height.
Can't find what you're looking for? Ask the community or share your knowledge.