Jump to content

Change rectangular array Number of Columns and Rows


Recommended Posts

Posted (edited)

Hello Everyone

How can i change A rectangular array properties such as Number of Columns , Rows , Column Spacing and row spacing through without using the (command "_arrayedit") method

thanks in advance

 

image.png.0ccba9bb342726cc55bcdd521e3fcff0.png

Edited by handasa
Posted

If you examine the code in KGA_Sys_ArrayType, and look at the elst variable, you will find that its last content is quite interesting. I would say it is probably very useful for your task. Note that [uu] should be replaced by [uU] in the function.

(
  (-1 . <Entity name: 2bc69980>)
  (0 . "ACDBASSOCACTION")
  (5 . "8E")
  (330 . <Entity name: 2bc69140>)
  (100 . "AcDbAssocAction")
  (90 . 2)
  (90 . 0)
  (330 . <Entity name: 2bc69140>)
  (360 . <Entity name: 2bc690c0>)
  (90 . 1)
  (90 . 3)
  (90 . 3)
  (360 . <Entity name: 2bc69740>)
  (360 . <Entity name: 2bc69ac0>)
  (360 . <Entity name: 2bc697c0>)
  (90 . 0)
  (90 . 4)
  (360 . <Entity name: 2bc69580>)
  (360 . <Entity name: 2bc69600>)
  (360 . <Entity name: 2bc69480>)
  (360 . <Entity name: 2bc69180>)
  (90 . 0)
  (90 . 8)
  (90 . 0)
  (1 . "ItemSpacing")
  (90 . 1)
  (90 . 1)
  (40 . 179.081137259194)
  (90 . 0)
  (1 . "RowSpacing")
  (90 . 1)
  (90 . 1)
  (40 . 179.081137259194)
  (90 . 0)
  (1 . "LevelSpacing")
  (90 . 1)
  (90 . 1)
  (40 . 1.0)
  (90 . 0)
  (1 . "Items")
  (90 . 0)
  (90 . 1)
  (90 . 4)
  (90 . 0)
  (1 . "Rows")
  (90 . 0)
  (90 . 1)
  (90 . 3)
  (90 . 0)
  (1 . "Levels")
  (90 . 0)
  (90 . 1)
  (90 . 1)
  (90 . 0)
  (1 . "RowElevation")
  (90 . 1)
  (90 . 1)
  (40 . 0.0)
  (90 . 0)
  (1 . "AxesAngle")
  (90 . 2)
  (90 . 1)
  (40 . 1.5707963267949)
)

 

Posted
12 hours ago, Roy_043 said:
12 hours ago, Roy_043 said:

If you examine the code in KGA_Sys_ArrayType, and look at the elst variable, you will find that its last content is quite interesting. I would say it is probably very useful for your task. Note that [uu] should be replaced by [uU] in the function.

i used this code to edit the entity data got from entget

(defun c:chr ()
(setq itm (car (entsel "select Array")))
(setq cols (getint "Number of columns"))

(setq ed (entget itm))
(setq ed2 (entget (cdr (assoc 330 ed))))
(setq ed3 (entget (cdr (assoc 330 ed2))))
(setq xs (split ed3 (vl-position (cons 1 "Items") ed3)))
(setq ed3 (append (car xs) (replace_element 3 (cons 90 cols) (cadr xs))))

(entupd (cdr (assoc -1 (entmod ed3))))
)


(defun split (lst n / rslt)
(setq rslt (cons (sublst lst 1 n) rslt))
(if (setq xn (sublst lst (1+ n) (length lst))) (setq rslt (cons  xn rslt)))
(reverse rslt)
)

(defun replace_element (index newelement lst)
(subst newelement (nth index lst) lst)
)

but the entmod and entupd function don't seem to work to update and reflect changes on the screen

Posted (edited)

It seems you are right. I use BricsCAD, but there it also seems impossible to entmod a parametric array. I did not know that. It could also be that we need to change other entities as well.

 

Note that your replace_element function is flawed. And you have not provide the sublst function. But in my test I have not used your code.

 

I would also strongly advise against un-indented code. I know that a certain frequent poster has adopted this as his personal style, but at the end of the day it is just bad practice.

Edited by Roy_043
Posted (edited)
3 hours ago, Roy_043 said:

It seems you are right. I use BricsCAD, but there it also seems impossible to entmod a parametric array. I did not know that. It could also be that we need to change other entities as well.

the lisp change the number of rows and columns successfully in the properties palette.but it doesn't reflect the changes graphically unless i change them manually

image.png.f4eb5a9f66450fcbe3f32508d85ab835.png

Edited by handasa
Posted (edited)

Not sure about this but it may be the enties are stored as individual in a array rather than a simple row column factor so if went to 4 rather than 3 need to add entities.

 

(90 . 3) 3 rows ?
  (360 . <Entity name: 2bc69740>)
  (360 . <Entity name: 2bc69ac0>)
  (360 . <Entity name: 2bc697c0>)

new entity here.

 

You can get all the values as per the code above the only answer may be use -arrayedit.

Edited by BIGAL

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...