Jump to content

Recommended Posts

Posted

Hi Everyone,

I have a Lisp file to create a Layout, i given the Template file with full path, but while running it's taking another template by default.

When i trying in VLISP console it was working Perfectly and it takes correct Template. but when i trying with .lsp file I got the above issue. In the LSP file i have used the same script for A1, A2 and A3.

Please help me anyone to sort out this issue.

 

(defun c:A3()
(vl-load-com)
(command ".undo" "m")
(vlax-for layout (vla-get-layouts
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(if (/= (vla-get-name layout) "Model")
(vla-delete layout)
)
)
(setq sht_nos '() sht_no "") (command "tilemode" "1") 
(setq ss (ssget "X" '((2 . "A3") (66 . 1))))
(setq no_of_blocks(sslength ss))

(setq test 0)
(while (< test no_of_blocks)
(setq ent(ssname SS test))

(setq enx (entget (setq blk (entnext ent))))
;(print (item 1 enx))

(Setq entp(entget ent))
;(foreach a entp(print a))

(setq inspoint (item 10 entp))
(setq sht_no (item 1 enx))
(if (/= sht_no "-")
(progn
(command "-view" "w" sht_no inspoint "@396.0000,204.6493")  
(setq sht_nos(append sht_nos (list sht_no)))
);progn
)

(print (type sht_no))
;(print inspoint)(print vname)



(setq test (1+ test))
);while
(terpri)

(setq sorted_sname_list(VL-SORT sht_nos '<))
(plott sorted_sname_list)  
);defun DDP



(Defun ITEM (N E) (CDR (Assoc N E)))

(defun plott(shts)
(setq index 0)  
(repeat (length shts)

(command "_layout" "template" "//net.ats/data/AutoCAD Tools/Tools/Template/TBTemplate.dwt" "A3")
(command "_layout" "set" "A3")
(command "_layout" "rename" "A3" (strcat "A" (nth index shts)  ""))
(command "layout" "set" (strcat "A" (nth index shts) ""))
(command "mspace" "-view" "r" (nth index shts) )(command "pspace")
(command "-view" "d" (nth index shts))
(command "-vports" "L" "ON" "all" "")
 (setq index(+ 1 index)) 
 )

)  

 

Thanks in Advance.

Posted

Hi Everyone,

Please anyone suggest/help me solve this issue.

Posted

A couple of possibility don't have directories so a little hard to check

 

When I test something like this I just copy and paste a few lines at a time and look at what went wrong.

 

The ss ssget may need (0 . "INSERT") also so gets blocks.

 

View (list 396.0000,204.65)

 

"//net.ats/data/AutoCAD Tools/Tools/Template/TBTemplate.dwt" its a known problem spaces in directory need \\ rather than / so server is \\\\

 

The other thing is as its a layout why are you using a template would not Insert a dwg title block do the same ?

 

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