Jump to content

Make Object By layer in multiple layouts


pmadhwal7

Recommended Posts

Dear all,

i have done one mistake during creating layout that i was forget to make some object by layer and when i realized it was copy in nearly 100 layouts, i wnt to know that is their any way to do those object by layer at once? 

 

Drawing3.dwg

Link to comment
Share on other sites

I think I misread your request, so select all in pspace in a layout, then chprop to Bylayer ? Is that what you want just step through all layouts and change.

 

Are you meaning the Byblock plines  to be Bylayer ?

 

Post an image etc showing what is to be changed.

 

Maybe this.

 

(defun layoutbylay ( / lay x obj )
(vlax-for lay (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (/=  (vla-get-name lay) "Model")
(progn
  (setvar 'ctab (vla-get-name lay))
  (setvar 'tilemode 1)
  (setq ssall (ssget "x"))
  (setq x 0)
  (repeat (sslength ssall)
    (setq obj (vlax-ename->vla-object (ssname ssall x)))
    (vlax-put-property obj "Linetype" "Bylayer") 
    (vlax-put-property obj "Color" acbylayer)
    (vlax-release-object obj)
    (setq x (+ x 1))
 )
)
)
)
(princ)
)
(layoutbylay)

 

 

 

 

Edited by BIGAL
Link to comment
Share on other sites

As that initial object would now be a different object in each layout you would need a lisp that prompts to select one of them to get it's entity properties (less entity name) and modify every object with the same properties in Paper Space in the drawing.

Link to comment
Share on other sites

On 3/27/2021 at 7:11 AM, pmadhwal7 said:

Dear all,

i have done one mistake during creating layout that i was forget to make some object by layer and when i realized it was copy in nearly 100 layouts, i wnt to know that is their any way to do those object by layer at once? 

 

Drawing3.dwg 252.17 kB · 7 downloads

Question; Have you thought about using a viewport ( or creating a block \ xref ) to show the keymap linework? Copying this information to 100+ tabs does not make a whole lot of organizational sense.

 

Here's a quick example to change all color byblock items to bylayer:

(defun c:foo (/ s)
  ;; RJP » 2021-03-30
  ;; Change all color byblock objects to bylayer
  (if (setq s (ssget "_x" '((62 . 0))))
    (foreach e (mapcar 'cadr (ssnamex s)) (entmod (append (entget e) '((62 . 256)))))
  )
  (princ)
)

 

Edited by ronjonp
Link to comment
Share on other sites

On 3/30/2021 at 11:39 AM, BIGAL said:

I think I misread your request, so select all in pspace in a layout, then chprop to Bylayer ? Is that what you want just step through all layouts and change.

 

Are you meaning the Byblock plines  to be Bylayer ?

 

Post an image etc showing what is to be changed.

 

Maybe this.

 


(defun layoutbylay ( / lay x obj )
(vlax-for lay (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))
(if (/=  (vla-get-name lay) "Model")
(progn
  (setvar 'ctab (vla-get-name lay))
  (setvar 'tilemode 1)
  (setq ssall (ssget "x"))
  (setq x 0)
  (repeat (sslength ssall)
    (setq obj (vlax-ename->vla-object (ssname ssall x)))
    (vlax-put-property obj "Linetype" "Bylayer") 
    (vlax-put-property obj "Color" acbylayer)
    (vlax-release-object obj)
    (setq x (+ x 1))
 )
)
)
)
(princ)
)
(layoutbylay)

 

work fine but it was also change my hath color too is it possible to change particular object??? by clicking them

image.png.d06d13d95142d52a45823e5c1800fad8.png

 

 

 

Link to comment
Share on other sites

No need to cycle through tabs to change object properties .. this one will exclude hatch.

(defun c:foo (/ s)
  ;; RJP » 2021-03-31
  ;; Change all color byblock objects to bylayer
  (if (setq s (ssget "_x" '((0 . "~HATCH") (62 . 0))))
    (foreach e (mapcar 'cadr (ssnamex s)) (entmod (append (entget e) '((62 . 256)))))
  )
  (princ)
)

 

  • Like 1
Link to comment
Share on other sites

17 hours ago, ronjonp said:

No need to cycle through tabs to change object properties .. this one will exclude hatch.


(defun c:foo (/ s)
  ;; RJP » 2021-03-31
  ;; Change all color byblock objects to bylayer
  (if (setq s (ssget "_x" '((0 . "~HATCH") (62 . 0))))
    (foreach e (mapcar 'cadr (ssnamex s)) (entmod (append (entget e) '((62 . 256)))))
  )
  (princ)
)

 

great sir thanks a lot

Link to comment
Share on other sites

23 hours ago, ronjonp said:

Glad to help 🍻

one more question is it possible to change an object layer by selecting it in all layout sheets?

Link to comment
Share on other sites

If its in same location in every layout then its doable by picking one and get a pt to use in the other layouts with (ssget pt) but you may have to possibly open every layout. 

Link to comment
Share on other sites

14 hours ago, BIGAL said:

If its in same location in every layout then its doable by picking one and get a pt to use in the other layouts with (ssget pt) but you may have to possibly open every layout. 

location is same but layout is different some time object is also same

Link to comment
Share on other sites

Take the layoutbylay and use that code as a start, you just need to remove the repeat and replace with the (ssget pt) you should have selected the object at the start of the code, again this should work not tested (setq pt  (cadr (entsel "\nPick object ")))

 

Have a go only way to learn.

Edited by BIGAL
Link to comment
Share on other sites

On 4/3/2021 at 5:49 AM, pmadhwal7 said:

location is same but layout is different some time object is also same

Have you thought about organizing your drawings differently? IMO, some of these problems could be avoided.

  • Like 1
Link to comment
Share on other sites

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...