carmelo Posted May 11, 2020 Posted May 11, 2020 Hi all! With a little imagination and sweeping around, I have been able to create a routine to get the area. (defun c:ap (/ area e1 text) (command "PLINE" ) (setq area (vla-get-area (vlax-ename->vla-object (entlast)))) (setq e1 (entlast)) (command "-ERASE" e1 "") (princ "\nArea: ") (princ (rtos area)) (vl-load-com) (princ) ) The first and simple question is: How can i set the polyline width to, i.e., 0.02 and when i finish the lisp i reset the width to 0? The second and, maybe, more complex question is: Is it possible to fill "dynamically" the polyline, vertex by vertex? I hope the second question is clear. Thank you very much C Quote
marko_ribar Posted May 11, 2020 Posted May 11, 2020 (edited) You can't draw with width other than 0... That's how commands work in AutoCAD... You can though use PLINE command with previously set PLINEWID variable other than 0.0... As for filling areas, look into AREA command, it has implemented visual effects for presentation of area that is to be calculated... Also when command finished, you can recreate desired hatch if you had boundary pline generated from AREA command... But I don't know how can you implement PLINE with AREA command at the same time, but I suppose in future ACAD releases this may be considered as wish to be implemented if "they"-AutoDesk find it appropriate... Edited May 11, 2020 by marko_ribar Quote
carmelo Posted May 12, 2020 Author Posted May 12, 2020 On 5/11/2020 at 6:38 PM, marko_ribar said: You can't draw with width other than 0... That's how commands work in AutoCAD... You can though use PLINE command with previously set PLINEWID variable other than 0.0... As for filling areas, look into AREA command, it has implemented visual effects for presentation of area that is to be calculated... Also when command finished, you can recreate desired hatch if you had boundary pline generated from AREA command... But I don't know how can you implement PLINE with AREA command at the same time, but I suppose in future ACAD releases this may be considered as wish to be implemented if "they"-AutoDesk find it appropriate... I changed my code like this: (defun c:aap (/ pt area e1 text) (setq pt (GETPOINT "\nSpecify start point: ")) (command "PLINE" pt "_w" 0.02 0.02 ) (setq area (vla-get-area (vlax-ename->vla-object (entlast)))) (setq e1 (entlast)) (command "-ERASE" e1 "") (princ "\nArea: ") (princ (rtos area)) (vl-load-com) (princ) ) but, when i finish, how to reset the width to zero? Thanks marko_ribar but i use nanocad and not have Area command like Autocad... Quote
tombu Posted May 12, 2020 Posted May 12, 2020 2 hours ago, carmelo said: I changed my code like this: but, when i finish, how to reset the width to zero? Thanks marko_ribar but i use nanocad and not have Area command like Autocad... In AutoCAD you could start by saving the value of PLINEWID (setq PLINEWID (getvar "PLINEWID")) then after drawing the polyline finish by resetting it to what it was before. (setvar "PLINEWID" PLINEWID) Not familiar with nanocad it may work the same way. 1 Quote
BIGAL Posted May 12, 2020 Posted May 12, 2020 (edited) Try this forgot to hit post yesterday (defun c:ap (/ area e1 text) (setvar 'plinewid 0.2) (princ "\nPick pline points press c to close ") (command "PLINE" ) (while (= (getvar "cmdactive") 1 ) (command pause)) (setq area (vla-get-area (vlax-ename->vla-object (entlast)))) (command "-hatch" "s" (entlast) "" "p" "Ansi31" 1 0.0 "") (alert (strcat "Area: "(rtos area 2 1))) (command "ERASE" (entlast) "") (command "ERASE" (entlast) "") (setvar 'plinewid 0.0) (princ) ) Edited May 12, 2020 by BIGAL Quote
BIGAL Posted May 12, 2020 Posted May 12, 2020 An extra note Briscad Area E L Autocad Area O L Nanocad Area ? Quote
Roy_043 Posted May 13, 2020 Posted May 13, 2020 If you are talking about the _Area command: BricsCAD wll also accept the _Object option. Quote
carmelo Posted May 13, 2020 Author Posted May 13, 2020 10 hours ago, BIGAL said: Try this forgot to hit post yesterday (defun c:ap (/ area e1 text) (setvar 'plinewid 0.2) (princ "\nPick pline points press c to close ") (command "PLINE" ) (while (= (getvar "cmdactive") 1 ) (command pause)) (setq area (vla-get-area (vlax-ename->vla-object (entlast)))) (command "-hatch" "s" (entlast) "" "p" "Ansi31" 1 0.0 "") (alert (strcat "Area: "(rtos area 2 1))) (command "ERASE" (entlast) "") (command "ERASE" (entlast) "") (setvar 'plinewid 0.0) (princ) ) Thank you BIGAL... but in nanocad, hatch command open a dialog box and i can't disable the dialog box, so your code doesn't work... I remind you that the hatch command, or other way to fill my polyline, must be "dinamic" (as autocad area command, point by point increase the fill). I append a gif for i.e. Thank you very much 1 Quote
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.