Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert block to multiple layouts

6 REPLIES 6
Reply
Message 1 of 7
smjgsmith
3044 Views, 6 Replies

Insert block to multiple layouts

I'm trying to insert a block into 5 different layouts at one time. Is it possible to do this without changing from layout to layout and inserting each time.
At the moment I was thinking of changing CTAB to the relevant layout and then inserting at a fixed location. Is there a better way to do it. I'm only using autolisp (no vlisp).
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: smjgsmith

If you're inserting with (command "insert" ...
I think you'll have to set each layout current and then insert.

If you're entmaking the inserts you wouldn't need to set layouts current.

"smjgsmith" wrote in message
news:f18fbd5.-1@WebX.maYIadrTaRb...
> I'm trying to insert a block into 5 different layouts at one time. Is it
possible to do this without changing from layout to layout and inserting
each time.
> At the moment I was thinking of changing CTAB to the relevant layout and
then inserting at a fixed location. Is there a better way to do it. I'm only
using autolisp (no vlisp).
Message 3 of 7
smjgsmith
in reply to: smjgsmith

Thanks for the info Mark
Message 4 of 7
smjgsmith
in reply to: smjgsmith

This is what I came up with:-

(foreach layout (layoutlist)
(setvar "ctab" layout)
(command "-insert" "sign-001" "107.2,46.2,0.0" "" "" "")
);foreach

Is it possible to suppress the regen as you change tabs??
Message 5 of 7
Anonymous
in reply to: smjgsmith

"smjgsmith" wrote in message
news:f18fbd5.2@WebX.maYIadrTaRb...
> This is what I came up with:-
> (foreach layout (layoutlist)
> (setvar "ctab" layout)
> (command "-insert" "sign-001" "107.2,46.2,0.0" "" "" "")
> );foreach
>
> Is it possible to suppress the regen as you change tabs??
>

Not sure, you can try setting Regenauto to off but i don't know if that will
prompt you each time or just bypass the regen.
Message 6 of 7
Anonymous
in reply to: smjgsmith

try this....no regens except to set the first layout current, if the
block isn't already defined in the drawing it will insert it, providing
it is found in the current search path.

;| Code to insert a block in all PS Tabs in the same place,
By Jeff Mishler 10/2/03
usage:
(tabs_insert "titlesheet" '(10.0 20.0 0.0)) |;

(defun tabs_insert (bname inspt / )
;(setq inspt '(107.2 46.2 0.0)) ; can hard code insertion point here,
; just remove inspt from first line and don't enter the 2nd arg at
command
(setvar "ctab" (car (layoutlist)));sets current tab to first in list
(foreach x (layoutlist); cycle thru all tabs
(if (not (tblsearch "block" bname)); see if block is defined
(command "_.-insert" bname inspt "0" "" ""); nope, insert it
;else
(progn ;entmake insert to eliminate switching tabs
(entmake (list '(0 . "INSERT")
'(100 . "AcDbEntity")
'(67 . 1); insert in PS
(cons 410 x); tab name
'(8 . "0"); change this to the layer you want
'(100 . "AcDbBlockReference")
'(66 . 0); no attributes follow
(cons 2 bname); block name
(cons 10 inspt); insertion point
'(41 . 1.0) '(42 . 1.0) '(43 . 1.0);scale factors
'(50 . 0.0) ;rotation
'(70 . 0) '(71 . 0) '(44 . 0.0)'(45 . 0.0)
'(210 0.0 0.0 1.0)
);list
);entmake
);progn
);if
);foreach
(princ)
);defun


"smjgsmith" wrote in message
news:f18fbd5.2@WebX.maYIadrTaRb...
> This is what I came up with:-
> (foreach layout (layoutlist)
> (setvar "ctab" layout)
> (command "-insert" "sign-001" "107.2,46.2,0.0" "" "" "")
> );foreach
>
> Is it possible to suppress the regen as you change tabs??
>
Message 7 of 7
Mihai.Tanase
in reply to: Anonymous

Sorry

i am pretty new to lisp and to this community but beacuase it looks alot like something tht i am looking for i just have to ask :

How can it be done as a separate command? and to have it look for the block in another folder?Smiley Tongue

 

Tanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost