Sheet create from pre-defined templates.

Sheet create from pre-defined templates.

tcoley95E9Z
Enthusiast Enthusiast
484 Views
4 Replies
Message 1 of 5

Sheet create from pre-defined templates.

tcoley95E9Z
Enthusiast
Enthusiast

Hello all,

 

I am trying to make a lisp routine that, (from a given list such as 'General Notes', 'Layout', 'GPS', etc) creates a new sheet and pastes in the respective block (a set of pre-made callouts and etc needed for that specific sheet) at the point 0,0.

 

For simplicity I will keep these three sheets, the blocks will be named as according to the sheet names (General Notes.dwg, Layout.dwg, GPS.dwg). How can this be done? Would it also be possible to explode the block upon importing it?

0 Likes
485 Views
4 Replies
Replies (4)
Message 2 of 5

pendean
Community Legend
Community Legend

May I ask, why not have all of that defined in a TEMPLATE file, then start your new file from there, or for existing files, you just import those "sheets"?

0 Likes
Message 3 of 5

Kent1Cooper
Consultant
Consultant

By "a new sheet" do you mean a separate drawing file?  Or a Paper Space Layout within the current drawing?

 

If you "import" a Block with an INSERT command, preceding the Block name with an asterisk will put it in pre-Exploded.  Note that it will ask for only one scale factor, and you will not be able to visually drag it into place.

 

Couldn't drawing Template files take care of all of this for you?  Don't start a drawing and run a routine to set it up, but make it based on a Template file that already has it all set up.

Kent Cooper, AIA
0 Likes
Message 4 of 5

Sea-Haven
Mentor
Mentor

Like the others leave in a DWT, at the end of the task just purge out unused blocks. Reduces dwg size. As part of a quality check we would run a multi purge on a dwg, CIV3D requires extra steps when purging. Use a lisp or script.

0 Likes
Message 5 of 5

komondormrex
Mentor
Mentor

hey there,

check the following. creates layouts from the given list of names if there is none with such a name and inserts the respective block if it is found by findfile on the created layout at 0,0,0 point. 

(defun c:add_layout ( / add_layout layouts block_full_name)
	(setq add_layout '("General Notes" "Layout" "GPS")
		  layouts (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
	)
	(foreach add add_layout
		(if (setq block_full_name (findfile (strcat add ".dwg")))
			(if (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list layouts add))) 
				(vla-explode
					(vla-insertblock (vla-get-block (vla-add layouts add))
									 (vlax-3d-point 0 0 0)
									 block_full_name
									 1 1 1 0
					)
				)
			)
		)
	)
	(princ)
)

 

0 Likes