Jump to content

Recommended Posts

Posted

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?

image.png.1826325d1c3903ed98bf739e0fbae6a9.png

 

I hope the second question is clear.

Thank you very much :) 

C

Posted (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 by marko_ribar
Posted
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...
 

 

 

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

  • Like 1
Posted (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 by BIGAL
Posted

An extra note 

 

Briscad Area E L

 

Autocad Area O L

 

Nanocad Area ?

Posted

If you are talking about the _Area command: BricsCAD wll also accept the _Object option.

Posted

 

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

 

anim.gif

  • Like 1

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