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:
Array Help
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Array Help (Read 2824 times)
0 Members and 1 Guest are viewing this topic.
GDF
Water Moccasin
Posts: 2081
Array Help
«
on:
August 01, 2019, 09:58:57 AM »
I would like to get all of "SS" occurrences of the array; where "LEVELS" is the total number of the array repeat.
The code below will only pick up the first:
(setq SS (ssadd))
(command "array" (entlast) "" "r" (rtos (- LEVELS 1) 2 0) "1" flrheight)
(setq SS (ssadd (entlast) SS))
Thanks for any help
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
ronjonp
Needs a day job
Posts: 7526
Re: Array Help
«
Reply #1 on:
August 01, 2019, 11:47:32 AM »
Not exactly sure what you're asking for but this
should
return the number of columns and rows in an array.
Code - Auto/Visual Lisp:
[Select]
(
defun
c:foo
(
/
_getrc s
)
(
defun
_getrc
(
e
/
a
)
(
if
(
and
(
=
'ename
(
type
e
)
)
(
setq
a
(
cdr
(
member
'
(
102
.
"{ACAD_REACTORS"
)
(
entget
e
)
)
)
)
(
=
"ACDBASSOCDEPENDENCY"
(
cdr
(
assoc
0
(
setq
a
(
entget
(
cdar
a
)
)
)
)
)
)
(
=
"ACDBASSOCACTION"
(
cdr
(
assoc
0
(
setq
a
(
entget
(
cdr
(
assoc
330
a
)
)
)
)
)
)
)
)
(
list
(
cdar
(
cdddr
(
member
'
(
1
.
"Items"
)
a
)
)
)
(
cdar
(
cdddr
(
member
'
(
1
.
"Rows"
)
a
)
)
)
)
)
)
(
if
(
setq
s
(
ssget
'
(
(
0
.
"insert"
)
(
2
.
"`*U*"
)
)
)
)
(
foreach
e
(
vl
-
remove
-
if
'
listp
(
mapcar
'
cadr
(
ssnamex
s
)
)
)
(
print
(
_getrc e
)
)
)
)
(
princ
)
)
«
Last Edit: August 01, 2019, 11:53:47 AM by ronjonp
»
Logged
Windows 11 x64 - AutoCAD /C3D 2023
Custom Build PC
GDF
Water Moccasin
Posts: 2081
Re: Array Help
«
Reply #2 on:
August 01, 2019, 03:16:42 PM »
Thanks Ron
I'm having trouble with the selection set capturing all of the lines that make up the curtainwall in elevation.
I thought it was with the array command...now I'm not sure.
;;;;;;;;;;;;;;;;;;;;;;;; Curtainwall Elevation Function ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun draw_cwall ()...
Thanks for any guidance you can give me.
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
ronjonp
Needs a day job
Posts: 7526
Re: Array Help
«
Reply #3 on:
August 01, 2019, 04:35:15 PM »
Sorry Gary I'm not sure what you're trying to do.
An array is just a block so if you need to get all individual items, you could use vla-explode then have all the individual pieces to work with.
Logged
Windows 11 x64 - AutoCAD /C3D 2023
Custom Build PC
GDF
Water Moccasin
Posts: 2081
Re: Array Help
«
Reply #4 on:
August 01, 2019, 04:53:44 PM »
No problem...
Thanks anyway
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
GDF
Water Moccasin
Posts: 2081
Re: Array Help
«
Reply #5 on:
August 01, 2019, 06:09:18 PM »
I think I found a solution:
The
(setq ss (ssadd (entlast) ss))
was not picking up all of the linework in the selection set..
Replaced
(createblock-elev ss a))
With
(createblock-elev (ssget "X" '((0 . "LINE")(8 . "A-GLAZ-MULL"))) a))
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
GDF
Water Moccasin
Posts: 2081
Re: Array Help
«
Reply #6 on:
August 02, 2019, 09:45:50 AM »
For those following this thread, it was never an array problem. The problem was selection set gathering.
I also modified the code to replace the "Create Block Function" function with a "Raddom Generator Number" function.
Sorry for the confusion.
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Array Help