Hi alls
If you have a rectangle ,but you didn't know is it closed or open,my question is how to check it.
I just check with dxf and vla,it can not found,any body know ,please tell me.
Printable View
Hi alls
If you have a rectangle ,but you didn't know is it closed or open,my question is how to check it.
I just check with dxf and vla,it can not found,any body know ,please tell me.
(70 . 1) closed
(70 . 0) open
Hi kennet,
Ah....I made stupid question,it's really easy solution.
many thanks kennet you was open my lock brain
here any code to know that,and I confuse last time why close and open always zero value 1
(setq ss (car (entsel "\nSelect a open rectangle ")))Code:(defun c:opencloserec (/ p1 p2 p3 p4 p5)
(setq p1 '(0 0 0))
(setq p2 '(10 0 0))
(setq p3 '(10 5 0))
(setq p4 '(0 5 0))
(setq p5 '(0 0.5 0))
(command "_pline" p1 p2 p3 p4 p5 "") ; for open rectangle
;(command "_pline" p1 p2 p3 p4 "c" "") ; for closed rectangle
(princ)
)
(setq sse (entget ss))
(setq recopen (cdr (assoc 70 sse)))
((-1 . <Entity name: 7d23e270>)
(0 . "LWPOLYLINE")
(330 . <Entity name: 7ef60cf8>)
(5 . "FE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbPolyline")
(90 . 5)
(70 . 0)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 0.0 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 10.0 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 10.0 5.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 0.0 5.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 0.0 0.5)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(210 0.0 0.0 1.0))
_$
0
_$
(setq ss (car (entsel "\nSelect a open rectangle ")))
(setq sse (entget ss))
(setq recclosed (cdr (assoc 70 sse)))
<Entity name: 7d23e280>
((-1 . <Entity name: 7d23e280>)
(0 . "LWPOLYLINE")
(330 . <Entity name: 7ef60cf8>)
(5 . "100")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbPolyline")
(90 . 4)
(70 . 1)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 0.0 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 10.0 0.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 10.0 5.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 0.0 5.0)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(210 0.0 0.0 1.0))
1
_$
Code:(defun c:test (/ ss sse)
(setq ss (car (entsel "\nSelect a rectangle")))
(setq sse (entget ss))
(if
(= (cdr (assoc 70 sse)) 1)
(alert "\nYour choose rectangle is CLOSED")
(alert "\nYour choose rectangle is OPEN")
)
(princ)
)
[ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]Quote:
Originally Posted by kennet.sjoberg
Why not just check in the Properties Dialog Box? Just select it and it will say wether the polyline is opened or closed.
Because quite often when you have the user in the middle of a routine, your routine really needs to know the answer to this and you usually can't rely on the user to do it for you, so you decide it's probably best to get yourself programatically.Quote:
Originally Posted by srb
:-D
Jeff
Thanks,
I lurk behind the scenes and try to learn a little about lisp & VBA.