TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MvdP on August 11, 2006, 07:16:27 AM

Title: How to change the plot scale in my pagesetup?
Post by: MvdP on August 11, 2006, 07:16:27 AM
I am creating a drawing setup routine and encountered a problem/question.

How can i change the plot scale in my pagesetup in lisp. (deafult in dwt is 1:1) to f.e. 1:100.?

It has something to do  with

Code: [Select]
vla-setCustomScale
but i can't figure this out.
Title: Re: How to do this.?
Post by: Patrick_35 on August 11, 2006, 07:22:26 AM
Hi
Use vla-put-StandardScale

ex :
Code: [Select]
(setq tra (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) 0))
(vla-SetCustomScale tra 1.0 100.0)
or (vla-put-StandardScale 26)
@+
Title: Re: How to do this.?
Post by: MvdP on August 11, 2006, 07:42:12 AM
Maybe a stupid question.But how do i do that.?

Ok i see. Thanks.
Title: Re: How to do this.?
Post by: MvdP on August 11, 2006, 08:13:09 AM
And how can change the the papersize from f.i. A0 to A1.?

I thougt this

Code: [Select]
(setq putformaattolayout (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) 0))
(vla-CanonicalMediaName putformaattolayout ISO_expand_A0_(841.00_x_1189.00_MM) ISO_expand_A1_(594.00_x_841.00_MM))


 was the way to go.But gives me this error.

error: no function definition: 841
Title: Re: How to do this.?
Post by: Patrick_35 on August 11, 2006, 09:34:18 AM
Code: [Select]
(vla-put-CanonicalMediaName tra "A1")
And for the lisp of paper
Code: [Select]
(defun format_papier(imp / def esp n lay lst)
  (if (zerop (getvar "tilemode"))
    (setq esp (vla-get-paperspace (vla-get-ActiveDocument (vlax-get-acad-object))))
    (setq esp (vla-get-modelspace (vla-get-ActiveDocument (vlax-get-acad-object))))
  )
  (setq lay (vla-get-layout esp) def (vla-get-configname lay))
  (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-configname (list lay imp))))
    (progn
      (vla-RefreshPlotDeviceInfo lay)
      (setq lst (mapcar '(lambda (x) (vla-GetLocaleMediaName lay x)) (vlax-safearray->list (vlax-variant-value (vla-GetCanonicalMediaNames lay)))))
      (vla-put-configname lay def)
    )
    (setq lst '(""))
  )
  lst
)

(format_papier (vla-get-configname tra))

@+
Title: Re: How to do this.?
Post by: MvdP on August 11, 2006, 01:01:26 PM
Thanks Patrick_35
I will try this

Code: [Select]
(setq tra (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) 0))
(vla-SetCustomScale tra 1.0 100.0)
(vla-put-CanonicalMediaName tra "A1")


 on monday when i am back at work.
Right know i am having my well deserved weekend.
Title: Re: How to do this.?
Post by: MvdP on August 14, 2006, 02:18:23 AM
This is driving me mad.When i load this routine (ap)


Code: [Select]
(setq getopzetschaal schaal)
(setq putplotschaaltolayout (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) 0))
(vla-SetCustomScale putplotschaaltolayout 1.0 getopzetschaal)
(vla-put-CanonicalMediaName putplotschaaltolayout "ISO_expand_A1_(841.00_x_594.00_MM)")

it is working (except is it rotated from landscape to portrait) but when i implement this

Code: [Select]

(defun putinfotolayoput(/)
(setq getopzetschaal schaal)
(setq putplotschaaltolayout (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) 0))
(vla-SetCustomScale putplotschaaltolayout 1.0 getopzetschaal)
)

(if (= tm "J")(putinfotolayoput))

in my drawing setup routine it is not.It gives the following error

Code: [Select]
ActiveX Server returned an error: Parameter niet optioneel
What am i doing wrong.? And can i change the orientation  from portrait to landscape.?




Edit..........1


I got figured out.
But one questions stays.How to change the orientation.?

Edit..........2
I got figured out again.I changed the orientation this way
Code: [Select]
(vla-put-PlotRotation putalltolayout 0)
Title: Re: How to do this.?
Post by: Kerry on August 14, 2006, 04:58:43 AM

Edit..........


I got figured out.

It would be nice if you shared the solution that you have used.
you could even post your complete routine, with a description of what it does ... this would help people trying to follow the thread ... now and next month.
Title: Re: How to do this.?
Post by: MvdP on August 14, 2006, 05:17:31 AM
The solution for the problem was simple i misplaced the defun section.
And i can post the complete code( unfortunately all in Dutch) but it is still in progress and not completely done.And this is what it eventually should do.

- Choose drawing scale
- choose drawing format
- Choose if border should be drawn
- Choose to set it up in model or papaerspace(if ps put scale and forrmat to layout and create view)
- Make all dimensions and styles
- Choose which layers should be made.
Title: Re: How to do this.?
Post by: Kerry on August 14, 2006, 05:49:17 AM
Have you had a look at the PSETUPIN command ?
Title: Re: How to do this.?
Post by: MvdP on August 14, 2006, 06:01:23 AM

Have you had a look at the PSETUPIN command ?


Yes off course i did.
Title: Re: How to do this.?
Post by: Kerry on August 14, 2006, 06:06:22 AM
OK,
The only reason I ask is because I find it excellent for setting up plot configs without resorting to hard coding a plot configuration.