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)
»
Topic:
Edit Block Attribute
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Edit Block Attribute (Read 1303 times)
0 Members and 1 Guest are viewing this topic.
amc.dicsac
Newt
Posts: 109
Autocad 2008
WWW
Edit Block Attribute
«
on:
December 12, 2017, 01:08:51 PM »
Hello, I have the following code that allows me to select polylines to save the distance and then insert a block with an attribute, but the problem is how I add the distance to the attribute.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:pee
(
/
s i e Long Cadena BlockEsc BlockName Msj_Bloque
)
(
vl-load-com
)
(
setvar
"cmdecho"
0
)
(
setq
s
(
ssget
'
(
(
0
.
"ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE"
)
(
-
4
.
"<NOT"
)
(
-
4
.
"<AND"
)
(
0
.
"POLYLINE"
)
(
-
4
.
"&"
)
(
70
.
80
)
(
-
4
.
"AND>"
)
(
-
4
.
"NOT>"
)
)
)
)
(
setq
i
(
sslength
s
)
)
(
setq
e
(
ssname
s
(
setq
i
(
1-
i
)
)
)
)
(
setq
Long
(
rtos
(
vlax-curve-getdistatparam
e
(
vlax-curve-getendparam
e
)
)
2
2
)
)
(
setq
Cadena
(
strcat
"L="
Long
"m"
)
)
(
setq
BlockEsc
"1"
)
(
setq
BlockName
"1-DZL-BLOCK PENDIENTE"
)
(
setq
Msj_Bloque
(
strcat
"
\n
>> Especifica inserción del bloque [ "
BlockName
" ]: "
)
)
(
princ
Msj_Bloque
)
(
command
"._insert"
BlockName
"_s"
BlockEsc Cadena
)
(
while
(
=
(
logand
(
getvar
"cmdactive"
)
1
)
1
)
(
command
pause
)
)
(
setvar
"cmdecho"
1
)
(
princ
)
)
Logged
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>
BIGAL
Swamp Rat
Posts: 1419
40 + years of using Autocad
Re: Edit Block Attribute
«
Reply #1 on:
December 13, 2017, 05:45:46 AM »
If you have say a block with a single attribute length then just
Code:
[Select]
(command "-insert" Blockname pt 1 1 0 attributevalue)
Logged
A man who never made a mistake never made anything
HasanCAD
Swamp Rat
Posts: 1422
Re: Edit Block Attribute
«
Reply #2 on:
December 13, 2017, 07:45:41 AM »
I belive you have to save the block in a seperete file to call if not exist in file.
filename should has file extention
Code - Auto/Visual Lisp:
[Select]
(
setq
BlockName
"c:/MyBlocks/1-DZL-BLOCK PENDIENTE.dwg"
)
And this line changed too
Code - Auto/Visual Lisp:
[Select]
(
command
"._insert"
BlockName Msj_Bloque BlockEsc BlockEsc BlockEsc Cadena
)
Not Tested
Logged
Sorry for my English.
Donate to Theswamp
www.sergiwa.com
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Edit Block Attribute