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

vla-put-canonicalmedianame

6 REPLIES 6
Reply
Message 1 of 7
matthew_taylor
2189 Views, 6 Replies

vla-put-canonicalmedianame

Hello everybody!
I HAD my VLISP plotting working brilliantly...
Now that we have new plotters, I'm having a little trouble with setting the canonicalmedianame!
I use the two utilities below (cribbed from this site; sorry I seem to have lost the credits) to get the media size. That all works fine, but I'm having trouble setting the papersize to the layout object.

I'm plotting to a PC3 file going to a system printer (Oce TDS450).
This line produces the error:
(vl-catch-all-error-p (vl-catch-all-apply
'vla-put-canonicalmedianame (list TABOBJ PLOTTERPAPERSIZE)))

I have tried the medianame as it comes, UPPER and lower cases, replacing the spaces with underscores (_) to no avail. Does anybody have a clue what I need to do to set the medianame correctly?
This is the media name: "Oce A1 594x841 mm"

Any help would be gratefully received!

Thanks,

Matt


(setq LPAPERSIZE "A1")
(setq PLOTTERPAPERSIZE (WSPCS:GETMEDIASIZE:GLMN LPAPERSIZE))


;;;(WSPCS:GLMN:LIST)
(defun WSPCS:GLMN:LIST (/ GLMN:LIST ACTLAYOUT PLNM)
;; getting cannonical media names
(setq ACTLAYOUT (vla-get-activelayout (WSPCS:ACTIVE-DOCUMENT)))
(vla-refreshplotdeviceinfo ACTLAYOUT)
(setq PLNM (vla-getcanonicalmedianames ACTLAYOUT))
;; list of canonnical media names
(princ (vla-get-configname ACTLAYOUT))
(setq GLMN:LIST '())
(foreach ITM (vlax-safearray->list (vlax-variant-value PLNM))
(setq GLMN:LIST (cons (vla-getlocalemedianame ACTLAYOUT ITM) GLMN:LIST)))
(reverse GLMN:LIST))
;;( WSPCS:GETMEDIASIZE:GLMN "A1")
(defun WSPCS:GETMEDIASIZE:GLMN (PAPERSIZE / MEDIALIST TMEDIASIZE CNTR MEDIASIZE CNTR2)
(setq MEDIALIST (WSPCS:GLMN:LIST)
CNTR 0
CNTR2 CNTR)
(while (< CNTR (length MEDIALIST))
(setq TMEDIASIZE (nth CNTR MEDIALIST))
(if (or (wcmatch (strcase TMEDIASIZE) (strcat "*" "OVERSIZE" "*" PAPERSIZE "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*" "OVERSIZE" "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" "EXPAND" "*" PAPERSIZE "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*" "EXPAND" "*")))
(setq MEDIASIZE TMEDIASIZE
CNTR (length MEDIALIST))
(setq CNTR (1+ CNTR))))
(if (not MEDIASIZE)
(while (< CNTR2 (length MEDIALIST))
(setq TMEDIASIZE (nth CNTR2 MEDIALIST))
(if (or (wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*")))
(setq MEDIASIZE TMEDIASIZE
CNTR2 (length MEDIALIST))
(setq CNTR2 (1+ CNTR2)))))
MEDIASIZE) Message was edited by: Matt Taylor

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
6 REPLIES 6
Message 2 of 7
bnarum1
in reply to: matthew_taylor

set desired paper and then run this..

(vla-get-CanonicalMediaName (vla-get-activelayout (vla-get-ActiveDocument (vlax-get-acad-object))))

this will tell you the variable you need to set. It maybe something different than the plot dialog is showing.
Message 3 of 7

bnarum,
A good study of reverse engineering!
It worked great, thanks for your help.

Matt

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 4 of 7
bnarum1
in reply to: matthew_taylor

your welcome
these are words I live by...
"We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein
Message 5 of 7

Love it!

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
Message 6 of 7
Anonymous
in reply to: matthew_taylor

replacing spaces w/ underscores might not be accurate, u can create a list
of the
locale meda names and their corresponding canonical mdia names
something like this

(setq aobj (vlax-get-Acad-object)
adoc (vla-get-ActiveDocument aobj)
alob (vla-Get-ActiveLayout adoc))
(vla-put-Configname alob "Oce TDS450.pc3")
(vla-RefreshPlotDeviceInfo alob)
(setq tls nil plnm (vla-GetCanonicalMediaNames alob)) ;; list of
canonnical media names

(foreach itm (vlax-safearray->list (vlax-variant-value plnm))
(setq tls (cons (cons (vla-GetLocaleMediaName alob itm) itm) tls)) )

;; tls is the list of all the sheet names with their corresponding canonical
name

HTH







wrote in message news:5387341@discussion.autodesk.com...
Hello everybody!
I HAD my VLISP plotting working brilliantly...
Now that we have new plotters, I'm having a little trouble with setting the
canonicalmedianame!
I use the two utilities below (cribbed from this site; sorry I seem to have
lost the credits) to get the media size. That all works fine, but I'm having
trouble setting the papersize to the layout object.

I'm plotting to a PC3 file going to a system printer (Oce TDS450).
This line produces the error:
(vl-catch-all-error-p (vl-catch-all-apply
'vla-put-canonicalmedianame (list TABOBJ PLOTTERPAPERSIZE)))

I have tried the medianame as it comes, UPPER and lower cases, replacing the
spaces with underscores (_) to no avail. Does anybody have a clue what I
need to do to set the medianame correctly?
This is the media name: "Oce A1 594x841 mm"

Any help would be gratefully received!

Thanks,

Matt


(setq LPAPERSIZE "A1")
(setq PLOTTERPAPERSIZE (WSPCS:GETMEDIASIZE:GLMN LPAPERSIZE))


;;;(WSPCS:GLMN:LIST)
(defun WSPCS:GLMN:LIST (/ GLMN:LIST ACTLAYOUT PLNM)
;; getting cannonical media names
(setq ACTLAYOUT (vla-get-activelayout (WSPCS:ACTIVE-DOCUMENT)))
(vla-refreshplotdeviceinfo ACTLAYOUT)
(setq PLNM (vla-getcanonicalmedianames ACTLAYOUT))
;; list of canonnical media names
(princ (vla-get-configname ACTLAYOUT))
(setq GLMN:LIST '())
(foreach ITM (vlax-safearray->list (vlax-variant-value PLNM))
(setq GLMN:LIST (cons (vla-getlocalemedianame ACTLAYOUT ITM)
GLMN:LIST)))
(reverse GLMN:LIST))
;;( WSPCS:GETMEDIASIZE:GLMN "A1")
(defun WSPCS:GETMEDIASIZE:GLMN (PAPERSIZE / MEDIALIST TMEDIASIZE CNTR
MEDIASIZE CNTR2)
(setq MEDIALIST (WSPCS:GLMN:LIST)
CNTR 0
CNTR2 CNTR)
(while (< CNTR (length MEDIALIST))
(setq TMEDIASIZE (nth CNTR MEDIALIST))
(if (or (wcmatch (strcase TMEDIASIZE) (strcat "*" "OVERSIZE" "*"
PAPERSIZE "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*" "OVERSIZE" "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" "EXPAND" "*" PAPERSIZE "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*" "EXPAND" "*")))
(setq MEDIASIZE TMEDIASIZE
CNTR (length MEDIALIST))
(setq CNTR (1+ CNTR))))
(if (not MEDIASIZE)
(while (< CNTR2 (length MEDIALIST))
(setq TMEDIASIZE (nth CNTR2 MEDIALIST))
(if (or (wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*"))
(wcmatch (strcase TMEDIASIZE) (strcat "*" PAPERSIZE "*")))
(setq MEDIASIZE TMEDIASIZE
CNTR2 (length MEDIALIST))
(setq CNTR2 (1+ CNTR2)))))
MEDIASIZE)

Message was edited by: Matt Taylor
Message 7 of 7

Stylish solution Mark, thank you!
I'll incorporate this into my function.

Cheers for your time,

Matt

Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?

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

Post to forums  

Forma Design Contest


AutoCAD Beta