Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
XDRX-API
»
Topic:
[XDrX-PlugIn(35)] Polyline coordinate point information statistics table
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: [XDrX-PlugIn(35)] Polyline coordinate point information statistics table (Read 685 times)
0 Members and 1 Guest are viewing this topic.
xdcad
Swamp Rat
Posts: 527
WWW
[XDrX-PlugIn(35)] Polyline coordinate point information statistics table
«
on:
December 04, 2023, 08:01:30 AM »
Code - Auto/Visual Lisp:
[Select]
(
defun
c:XDTB_PLSegList
(
/
#xd_table_res_z _lengths _format _writebulges _mergecell bulge bulges
verts i j c val lens lst r gl g
)
(
defun
_lengths
(
)
(
setq
g
(
xdge::constructor e
)
gl
(
xdge::getpropertyvalue g
"getcurvelist"
)
)
(
setq
lens
(
mapcar
'
(
lambda
(
x
)
(
xdge::getpropertyvalue x
"length"
)
)
gl
)
)
(
xdge::free g gl
)
lens
)
(
defun
_writebulges
(
tb
)
(
setq
rows
(
xdrx_table_numrows tb
)
)
(
setq
i
3
j
0
)
(
while
(
<
i
(
1-
rows
)
)
(
setq
bulge
(
_format
(
nth
j bulges
)
4
)
)
(
if
(
=
bulge
"0.0"
)
(
setq
bulge
""
)
)
(
xdrx_setpropertyvalue
tb
"textstring"
(
list
(
list
i
4
bulge
)
(
list
i
5
(
_format
(
nth
j lens
)
#xd_table_txt_bits
)
)
)
"textheight"
(
list
(
list
i
4
#xd_table_txt_height
)
(
list
i
5
#xd_table_txt_height
)
)
)
(
setq
j
(
1+
j
)
i
(
+
i
2
)
)
)
)
(
defun
_format
(
str bit
)
(
if
(
equal
str
0.0
1e
-
3
)
"0.0"
(
rtos
str
2
bit
)
)
)
(
defun
_mergecell
(
tb startCol endCol startRow
)
(
setq
rows
(
xdrx_table_numrows tb
)
)
(
setq
c startCol
)
(
while
(
<=
startCol c endCol
)
(
setq
r startRow
)
(
while
(
<
r
(
1-
rows
)
)
(
xdrx_table_mergecells tb r
(
1+
r
)
c c
)
(
setq
r
(
+
2
r
)
)
)
(
setq
c
(
1+
c
)
)
)
)
(
xdrx_begin
)
(
xdrx_sysvar_push '
(
"dimzin"
0
)
)
(
if
(
=
1
(
xdrx_yesorno
"
\n
Keep Z Coordinate"
0
)
)
(
setq
#xd_table_res_z t
)
)
(
if
(
not
#xd_table_txt_height
)
(
setq
#xd_table_txt_height
3.5
)
)
(
if
(
setq
val
(
getreal
(
xdrx_prompt
"
\n
Text Height<"
#xd_table_txt_height
">:"
t
)
)
)
(
setq
#xd_table_txt_height val
)
)
(
if
(
not
#xd_table_txt_bits
)
(
setq
#xd_table_txt_bits
1
)
)
(
if
(
setq
val
(
getint
(
xdrx_prompt
"
\n
Keep the number of decimal places for lengths<"
#xd_table_txt_bits
">:"
t
)
)
)
(
setq
#xd_table_txt_bits val
)
)
(
if
(
setq
e
(
car
(
xdrx_entsel
"
\n
Pick a Polyline<Exit>:"
'
(
(
0
.
"LWPOLYLINE"
)
)
)
)
)
(
progn
(
setq
verts
(
xdrx_getpropertyvalue e
"vertices"
"bulges"
)
lens
(
_lengths
)
bulges
(
cadr
verts
)
verts
(
car
verts
)
)
(
setq
lst
(
mapcar
'
(
lambda
(
x
)
(
list
(
_format
(
car
x
)
4
)
(
_format
(
cadr
x
)
4
)
(
_format
(
caddr
x
)
4
)
""
""
)
)
verts
)
)
(
setq
lst
(
xd::table:celltile
'
(
"Number"
"Coord X"
"Coord Y"
"Coord Z"
"Bulge"
"Length"
)
1
lst
)
)
(
setq
i
0
lst
(
mapcar
'
(
lambda
(
x
)
(
if
(
=
i
0
)
(
progn
(
setq
i
(
1+
i
)
)
(
list
x
)
)
(
list
x x
)
)
)
lst
)
lst
(
cons
(
list
"Polyline Coordinate information table"
nil
nil
nil
nil
nil
)
(
apply
'
append
lst
)
)
)
(
xd::text:init
1
)
(
setq
tb
(
xd::table:makefromlist lst pt #xd_table_txt_height
0.0
)
)
(
xd::table:begin tb
)
(
_mergecell tb
0
3
2
)
(
_mergecell tb
4
5
3
)
(
_writebulges tb
)
(
if
(
not
#xd_table_res_z
)
(
xdrx_table_deletecolumns tb
3
1
)
)
(
xdrx_table_setrowheight tb
0
(
*
2.0
#xd_table_txt_height
)
)
(
xdrx_table_setrowheight tb
1
(
*
2.0
#xd_table_txt_height
)
)
(
xdrx_setpropertyvalue
tb
"color"
7
"HorzCellMargin"
(
/
#xd_table_txt_height
2.0
)
"autosize"
t
)
(
xd::table:end tb
)
(
xd::drag:simplemove
(
entlast
)
"
\n
Table Insert:"
8
t
)
)
)
(
xdrx_sysvar_pop
)
(
xdrx_end
)
(
princ
)
)
«
Last Edit: December 04, 2023, 08:04:51 AM by xdcad
»
Logged
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
XDRX-API
»
Topic:
[XDrX-PlugIn(35)] Polyline coordinate point information statistics table