Jump to content

Recommended Posts

Posted (edited)

Most of our drawings have multiple Lay-out Tabs each has its own drawing number.

 

I want to all export these layouts each to a separate file, i tried using EXPORTLAYOUT command but an error occurs. error regarding "eDuplicateRecordName"

 

so i browse the net and found JTB's LayoutToDwgs routine under this link: http://www.jtbworld.com/lisp/layoutstodwgs.htm

 

its working but i want the routine to adopt the Layout Tab name instead of inputing a prefix.

 

can this be modified or any other better solution?

Edited by nod684
Posted (edited)

Me thinks the reason why the Author prompts for a Prefix is to avoid overwriting the file if the layout tab name happens to be the same as the filename.

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Creates separate drawings of all layouts.

;;; The new drawings are saved to the current drawings path

;;; and overwrites existing drawings.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

Its an easy mod Arnold. but i would NOT edit the original though.

 

as for "any other better solution?" , i think it cant get any better than what's on the link you posted :)

Edited by pBe
Posted
Me thinks the reason why the Author prompts for a Prefix is to avoid overwriting the file if the layout tab name happens to be the same as the filename.

 

Its an easy mod Arnold. but i would NOT edit the original though.

as for "any other better solution?" , i think it cant get any better than what's on the link you posted :)

 

Thanks for the prompt reply.

 

i also thought so pBe, EXPORTLAYOUT will work if not for the error that i am getting.

 

Furthermore, EXPORTLAYOUT only exports one Layout Tab at a time so you need to go through all the layouts and run the command.

Posted

i found a solution here.

http://www.theswamp.org/index.php?action=post;quote=240368;topic=19721.0;last_msg=326462

 

[font=Courier New](defun c:Tabs->Drawings (/ ActDoc MsObjList PsObjList dbxApp oVer FirstPass)

(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vlax-for obj (vla-get-ModelSpace ActDoc)
	(setq MsObjList (cons obj MsObjList))
)
(vlax-for lo (vla-get-Layouts ActDoc)
	(if (/= (vla-get-Name lo) "Model")
		(progn
			(setq FirstPass T)
			(vlax-for obj (vla-get-Block lo)
				(if (not FirstPass)
					(setq PsObjList (cons obj PsObjList))
					(setq FirstPass nil)
				)
			)
			(setq dbxApp
				(if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
					(vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
					(vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
				)
			)
			(vlax-invoke ActDoc 'CopyObjects MsObjList (vla-get-ModelSpace dbxApp))
			(vlax-invoke ActDoc 'CopyObjects PsObjList (vla-get-PaperSpace dbxApp))
			(vla-SaveAs dbxApp (strcat (vla-get-Path ActDoc) "\\" (vla-get-Name lo)))
			(vlax-release-object dbxApp)
			(setq dbxApp nil)
			(setq PsObjList nil)
		)
	)
)
(princ)
)[/font]

 

credits to T.Willey

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