TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DRIU on December 29, 2011, 06:28:16 PM
-
Hi,
I'm trying to calculate area of the buffer. I offset line in both directions, connected ends of result lines. And I have problem then I want to calculate area of intersecting buffers. Hatching don't work, you can see result.
Is there any simple solution to my problem or do I have to deal with intersetwith function?
-
You can get the are by the (street1 wide) times (street2 wide)
Please upload it as a 2008 or less DWG
-
You can get the are by the (street1 wide) times (street2 wide)
Please upload it as a 2008 or less DWG
not quite
You'll may need to take the angular relationship between the 'streets' into account.
... depends if the area is a true rectangle or just a parallelogram
-
I added a real life example of buffer area I want to calculate.
-
If it was me :
draw a closed polyline with the vertexes at the intersections bounding the area you are concerned with.
Query the polyline to determine it's area.
-
That looks like wall center lines with the offset wall lines cleaned up.
The exception is the dead end center line which would be flat and not rounded.
Just an observation.
-
Hi DRIU.
I use the AREA command , Object option , pick on the Hatch , and get it
Command: area
Specify first corner point or [Object/Add/Subtract]: o
Select objects:
Area = 2417.06, Perimeter = 487.90
It will be kept at the AREA system variable, until you take other AREA
Command: (getvar "area")
2417.06
-
I use the AREA command , Object option , pick on the Hatch , and get it
Thanks, but as it not hatching overlapping space, area is not correct.
-
If I sum the area of the 2 polylines , as posted by Kerry , it give me the same area I take from the AREA comand Obj Hatch
Command: area
Specify first corner point or [Object/Add/Subtract]: o
Select objects: I pick on the small blue polyline
Area = 110.26, Perimeter = 39.91
Command:
AREA
Specify first corner point or [Object/Add/Subtract]: o
Select objects: the big polyline
Area = 2306.80, Perimeter = 448.00
Command:
AREA
Specify first corner point or [Object/Add/Subtract]: o
Select objects: the hatch
Area = 2417.06, Perimeter = 487.90
As it can be see , the sum of the 2 polys area is equal to the hacht area
Please clear me.
-
Hi,
And I have problem then I want to calculate area of intersecting buffers. Hatching don't work, you can see result.
I dont know if this can help you, and i forgot the original author.
Assume if boundaries are lwpolyline.
(defun c:minters (/ *acad* *acdoc* ss space clst rlst reg hatch)
(vl-load-com)
(setvar "cmdecho" 0)
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *acdoc* (setq *acdoc* (vla-get-activedocument *acad*)))
(if (ssget '((0 . "CIRCLE,LWPOLYLINE")))
(progn (vlax-for c (setq ss (vla-get-activeselectionset *acdoc*))
(setq clst (cons c clst))
)
(vla-delete ss)
(setq space (if (= 1 (getvar 'cvport))
(vla-get-paperspace *acdoc*)
(vla-get-modelspace *acdoc*)
)
)
(setq rlst (vlax-invoke space 'addregion clst))
(setq reg (car rlst)
rlst (cdr rlst)
)
(while rlst
(vla-boolean reg acintersection (car rlst))
(setq rlst (cdr rlst))
)
(if (< 0.0 (vla-get-area reg))
(progn (setq hatch (vla-addhatch space achatchpatterntypepredefined "ANSI31" :vlax-false 0)
)
(vlax-invoke hatch 'appendouterloop (list reg))
(vlax-put-property hatch 'patternscale 100.)
(vlax-put-property hatch 'color acred)
(vla-evaluate hatch)
(command "Explode" (vlax-vla-object->ename reg))
;;(vla-delete reg)
(setvar "PEDITACCEPT" 1)
(command "_.PEDIT"
"_M"
"P"
""
"_J"
0.0
"w"
10.
""
)
(command "_.CHPROP" "L" "" "C" 6 "");_=>>substitute with function area
)
)
)
)
)
(princ)
)
m4rdy
-
The thing that sidetracks most problem solving is definition of terms.
What is a buffer area. ?
-
Thank you m4rdy for code, I had no knowledge about regions and about union. That's what I was looking for.
(vla-boolean _o1 acUnion _o2)