TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started 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
vla-setCustomScale
but i can't figure this out.
-
Hi
Use vla-put-StandardScale
ex :
(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)
@+
-
Maybe a stupid question.But how do i do that.?
Ok i see. Thanks.
-
And how can change the the papersize from f.i. A0 to A1.?
I thougt this
(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
-
(vla-put-CanonicalMediaName tra "A1")
And for the lisp of paper
(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))
@+
-
Thanks Patrick_35
I will try this
(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.
-
This is driving me mad.When i load this routine (ap)
(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
(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
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
(vla-put-PlotRotation putalltolayout 0)
-
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.
-
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.
-
Have you had a look at the PSETUPIN command ?
-
Have you had a look at the PSETUPIN command ?
Yes off course i did.
-
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.