Author Topic: Array Help  (Read 418 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2000
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
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2019x64 Windows 10x64

ronjonp

  • Needs a day job
  • Posts: 7050
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]
  1. (defun c:foo (/ _getrc s)
  2.   (defun _getrc (e / a)
  3.     (if (and (= 'ename (type e))
  4.              (setq a (cdr (member '(102 . "{ACAD_REACTORS") (entget e))))
  5.              (= "ACDBASSOCDEPENDENCY" (cdr (assoc 0 (setq a (entget (cdar a))))))
  6.              (= "ACDBASSOCACTION" (cdr (assoc 0 (setq a (entget (cdr (assoc 330 a)))))))
  7.         )
  8.       (list (cdar (cdddr (member '(1 . "Items") a))) (cdar (cdddr (member '(1 . "Rows") a))))
  9.     )
  10.   )
  11.   (if (setq s (ssget '((0 . "insert") (2 . "`*U*"))))
  12.     (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (print (_getrc e)))
  13.   )
  14.   (princ)
  15. )
« Last Edit: August 01, 2019, 11:53:47 AM by ronjonp »

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

GDF

  • Water Moccasin
  • Posts: 2000
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.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2019x64 Windows 10x64

ronjonp

  • Needs a day job
  • Posts: 7050
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.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

GDF

  • Water Moccasin
  • Posts: 2000
Re: Array Help
« Reply #4 on: August 01, 2019, 04:53:44 PM »
No problem...

Thanks anyway
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2019x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2000
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))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2019x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2000
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.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2019x64 Windows 10x64