PDA

View Full Version : Drawing Procedure Format...


BoKirra
2008-12-15, 10:51 AM
Hi ALL,

I am going to draw an object with 25 points in my routine.
I have two formats as show below.
Could you please having a look & let me know which is the best & why.
You helps would be much appreciated.

Procedure 1
(setq Point01 ...)
(setq Point02 ...)
...
(setq Point25 ...)

(command "pline" Point01 Point02 Point03 Point04 "")
(setq Entity01 (entlast))
(command "chprop" Entity01 "" "la" "Layer01" "")
(command "pline" Point05 Point06 Point07 Point08 "")
(setq Entity02 (entlast))
(command "chprop" Entity02 "" "la" "Layer02" "")
(command "pline" Point09 Point10 Point11 Point12 "")
(setq Entity03 (entlast))
(command "chprop" Entity03 "" "la" "Layer03" "")
(command "pline" Point13 Point14 Point15 Point16 "")
(setq Entity04 (entlast))
(command "chprop" Entity04 "" "la" "Layer04" "")
(command "pline" Point17 Point18 Point19 Point20 "")
(setq Entity05 (entlast))
(command "chprop" Entity05 "" "la" "Layer05" "")
(command "pline" Point21 Point22 Point23 Point24 "")
(setq Entity06 (entlast))
(command "chprop" Entity06 "" "la" "Layer06" "")
(command "pline" Point01 Point05 Point09 Point13 Point17 Point21 Point01 "")
(setq Entity07 (entlast))
(command "chprop" Entity07 "" "la" "Layer07" "")
Procsdure 2
(setq Point01 ...)
(setq Point02 ...)
...
(setq Point25 ...)

(command "pline" Point01 Point02 Point03 Point04 "")
(setq Entity01 (entlast))
(command "pline" Point05 Point06 Point07 Point08 "")
(setq Entity02 (entlast))
(command "pline" Point09 Point10 Point11 Point12 "")
(setq Entity03 (entlast))
(command "pline" Point13 Point14 Point15 Point16 "")
(setq Entity04 (entlast))
(command "pline" Point17 Point18 Point19 Point20 "")
(setq Entity05 (entlast))
(command "pline" Point21 Point22 Point23 Point24 "")
(setq Entity06 (entlast))
(command "pline" Point01 Point05 Point09 Point13 Point17 Point21 Point01 "")
(setq Entity07 (entlast))
(command "chprop" Entity01 "" "la" "Layer01" "")
(command "chprop" Entity02 "" "la" "Layer02" "")
(command "chprop" Entity03 "" "la" "Layer03" "")
(command "chprop" Entity04 "" "la" "Layer04" "")
(command "chprop" Entity05 "" "la" "Layer05" "")
(command "chprop" Entity06 "" "la" "Layer06" "")
(command "chprop" Entity07 "" "la" "Layer07" "")

'gile'
2008-12-15, 05:44 PM
Hi,

Both methods are doing the same thing, I think a better way should be to use the entmake (or entmakex) function so that you can directly attribute properties to the enity, more, with entmake you won't have any problem with running osnaps.

(entmake
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 "Layer01") ; layer
'(100 . "AcDbPolyline")
'(90 . 4) ; number of vertices
'(70 . 0) ; opened
(cons 10 Point01)
(cons 10 Point02)
(cons 10 Point03)
(cons 10 Point04)
)
)

(entmake
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 "Layer02") ; layer
'(100 . "AcDbPolyline")
'(90 . 4) ; number of vertices
'(70 . 0) ; opened
(cons 10 Point05)
(cons 10 Point06)
(cons 10 Point07)
(cons 10 Point08)
)
)

...

(entmake
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 "Layer07") ; layer
'(100 . "AcDbPolyline")
'(90 . 6) ; number of vertices
'(70 . 1) ; closed
(cons 10 Point01)
(cons 10 Point05)
(cons 10 Point09)
(cons 10 Point13)
(cons 10 Point17)
(cons 10 Point21)
)
)

BoKirra
2008-12-16, 12:43 AM
Hi,

Both methods are doing the same thing, I think a better way should be to use the entmake (or entmakex) function so that you can directly attribute properties to the enity, more, with entmake you won't have any problem with running osnaps.

(entmake
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 "Layer01") ; layer
'(100 . "AcDbPolyline")
'(90 . 4) ; number of vertices
'(70 . 0) ; opened
(cons 10 Point01)
(cons 10 Point02)
(cons 10 Point03)
(cons 10 Point04)
)
)

(entmake
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 "Layer02") ; layer
'(100 . "AcDbPolyline")
'(90 . 4) ; number of vertices
'(70 . 0) ; opened
(cons 10 Point05)
(cons 10 Point06)
(cons 10 Point07)
(cons 10 Point08)
)
)

...

(entmake
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 "Layer07") ; layer
'(100 . "AcDbPolyline")
'(90 . 6) ; number of vertices
'(70 . 1) ; closed
(cons 10 Point01)
(cons 10 Point05)
(cons 10 Point09)
(cons 10 Point13)
(cons 10 Point17)
(cons 10 Point21)
)
)

Fabulous!
Thanks.