View Full Version : psltscale routine
Robert.Hall
2005-05-16, 03:38 PM
Anybody have a routine or macro that can be used to set
the psltcale variable to zero for each layout tab??
Currently I have to set psltscale to zero for each tab individually, pretty painful when
dealing with on average 15 layouts per drawing. Psltscale shoud be made a global variable.
pnorman
2005-05-16, 03:46 PM
Sorry but I don't.
And PSLTSCALE as a global var would be a complete disaster!!!!!
And why aren't you using PSLTSCALE = 1 anyway?
Sorry for the complete lack of help!! :)
paulmcz
2005-05-16, 04:13 PM
(defun c:ls ()
(setvar "psltscale" 0))
kennet.sjoberg
2005-05-16, 04:35 PM
(defun c:ls ()
(setvar "psltscale" 0)) paulmcz is that really for "each layout tab" ?
I do agree with pnorman.
: ) Happy Computing !
kennet
paulmcz
2005-05-16, 06:08 PM
This is what I use when I need it.
No, it does not change psltscale for each tab in one shot. You have to type > ls < when you open tab you need to set psltscale to 0. It is just a little less pain than typing psltscale every time.
I don't know how to make it global.
madcadder
2005-05-16, 06:52 PM
And why aren't you using PSLTSCALE = 1 anyway? XREFs.
xref dimscale set at 48
xref ltscale set to 24
viewport at 1/48xp
dashed lines would be solid if psltscale was at 1, so it's set to 0.
(or that's the reason we do it here.)
Tod
Robert.Hall
2005-05-16, 06:57 PM
Sorry but I don't.
And PSLTSCALE as a global var would be a complete disaster!!!!!
And why aren't you using PSLTSCALE = 1 anyway?
Sorry for the complete lack of help!! :)
For some reason a setting of 1 isn't working for the drawing files I have inherited......I am also not interested in adopting a color chart for linetypes while setting the ltscale to look good in paperspace.
If somebody knows how to set the PSLTSCALE to 0 for all layouts in one shot, I would certainly appreciate the help :-D
lance has a routine in this thread ( http://forums.augi.com/showthread.php?t=15652 ) to switch viewport to a certain layer. Maybe his vplmake routine will be off some use in this situation.
pnorman
2005-05-16, 07:48 PM
Something like should work BUT IT DOESN'T!!!
I can't work out how to access the PSLTSCALE setting for each layout. I can't find where the PSLTSCALE setting for the layout is stored!!!
Maybe someone else can modify this code with the right cons reference or change it to a dictionary modifier as required...
My time is up...
(defun acad-object ()
(cond (*acad-object*) ; Return the cached object
(t
(setq *acad-object* (vlax-get-acad-object))
)
)
)
(defun active-document ()
(cond (*active-document*) ; Return the cached object
(t
(setq *active-document* (vla-get-activedocument (acad-object)))
)
)
)
(defun ppn_set_psltscale (LAYOUTS PS_LTSC / my_layout_ob my_layout_en EN_DATA)
(foreach LAYOUT LAYOUTS
(progn
(setq my_layout_ob (vla-item (vla-get-layouts (active-document)) LAYOUT))
(setq my_layout_en (vlax-vla-object->ename my_layout_ob))
(setq EN_DATA (entget my_layout_en))
(setq EN_DATA (subst (cons 70 PS_LTSC) (assoc 70 EN_DATA) EN_DATA))
(entmod EN_DATA)
)
)
)
(defun c:pslts ( / *acad-object* *active-document*)
(ppn_set_psltscale (layoutlist) 0)
)
Good luck.
PS had a quick look at lance's code and don't think its relevant???
pnorman
2005-05-16, 08:05 PM
I think it is supposed to be the (70 . 1) item in the subclass AcDbLayout
but I do not know how to set it???
My program posted earlier sets the green (70 . 0) below not the red one?
((-1 . <Entity name: 7ef5a420>) (0 . "LAYOUT") (5 . "3829C") (102 .
"{ACAD_XDICTIONARY") (360 . <Entity name: 7ef641b0>) (102 . "}") (102 .
"{ACAD_REACTORS") (330 . <Entity name: 7ef56c70>) (102 . "}") (330 . <Entity
name: 7ef56c70>) (100 . "AcDbPlotSettings") (1 . "11x17") (2 .
"HP5000-South.pc3") (4 . "11x17") (40 . 4.23333) (41 . 4.23334) (42 . 8.46667)
(43 . 4.23334) (44 . 279.4) (45 . 431.8) (46 . 0.0) (47 . 0.0) (48 . 0.0) (49 .
0.0) (140 . 0.0) (141 . 0.0) (142 . 1.0) (143 . 1.0) (70 . 0) (72 . 1) (73 . 1)
(74 . 1) (7 . "RJC HP DesignJet 1050 100% TransBond.ctb") (75 . 0) (147 . 1.0)
(76 . 0) (77 . 2) (78 . 300) (148 . 0.0131826) (149 . 0.00854427) (100 .
"AcDbLayout") (1 . "Layout1") (70 . 1) (71 . 1) (10 0.0 0.0 0.0) (11 12.0 9.0
0.0) (12 0.0 0.0 0.0) (14 1.0e+020 1.0e+020 1.0e+020) (15 -1.0e+020 -1.0e+020
-1.0e+020) (146 . 0.0) (13 0.0 0.0 0.0) (16 1.0 0.0 0.0) (17 0.0 1.0 0.0) (76 .
0) (330 . <Entity name: 7ef5a418>) (331 . <Entity name: 7ef5a610>))
pnorman
2005-05-19, 05:01 AM
The following code seems to work fine. It updates the data for each layout in the drawing to set what I thought was the value for PSLTSCALE....BUT
psltscale doesn't actually change??
If anyone has any ideas what else needs to be done>>>
Otherwise its too hard for me so I give up!.!.!.!
(setq *acad-object* nil) ; Initialize global variable
(setq *active-document* nil) ; Initialize global variable
(defun acad-object ()
(cond (*acad-object*) ; Return the cached object
(t
(setq *acad-object* (vlax-get-acad-object))
)
)
)
(defun active-document ()
(cond (*active-document*) ; Return the cached object
(t
(setq *active-document* (vla-get-activedocument (acad-object)))
)
)
)
(defun model-space ()
(cond (*model-space*) ; Return the cached object
(t
(setq *model-space* (vla-get-modelspace (active-document)))
)
)
)
(defun ppn_set_psltscale (LAYOUTS PS_LTSC / my_layout_ob my_layout_en EN_DATA EN_DATA_SUB EN_DATA_PRE ITEM #)
(foreach LAYOUT LAYOUTS
(progn
(setq my_layout_ob (vla-item (vla-get-layouts (active-document)) LAYOUT))
(setq my_layout_en (vlax-vla-object->ename my_layout_ob))
(setq EN_DATA (entget my_layout_en))
(setq EN_DATA_SUB (member (cons 100 "AcDbLayout") EN_DATA))
(setq EN_DATA_SUB (subst (cons 70 PS_LTSC) (assoc 70 EN_DATA_SUB) EN_DATA_SUB))
(setq # 0)
(while (/= T (equal ITEM '(100 . "AcDbLayout")))
(progn
(setq ITEM (nth # EN_DATA))
(setq EN_DATA_PRE (cons ITEM EN_DATA_PRE))
(setq # (1+ #))
)
)
(setq EN_DATA_PRE (reverse (cdr EN_DATA_PRE)))
(setq EN_DATA (append EN_DATA_PRE EN_DATA_SUB))
(entmod EN_DATA)
(setq EN_DATA_PRE nil EN_DATA_SUB nil)
)
)
)
(defun c:pslts ()
(ppn_set_psltscale (layoutlist) 0)
(princ)
)
RobertB
2005-05-19, 06:41 AM
Some things are just so much easier in VBA.
Public Sub ResetPSLTScale()
Dim aLayout As AcadLayout
For Each aLayout In ThisDrawing.Layouts
ThisDrawing.ActiveLayout = aLayout
ThisDrawing.SetVariable "PSLTScale", 0
Next aLayout
ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("Model")
End Sub
pnorman
2005-05-19, 03:37 PM
Some things are just so much easier in VBA.
Thanks Robert. Would, a brief explanation of where to save this sub, how to load it and how to call it via say c:pslt, be to much to ask? Feel free to reply "R.T.F.M"
:)
P
RobertB
2005-05-19, 05:09 PM
Open the VBIDE. Place the code in the ThisDrawing object. Change the Project name to something useful, e.g. "SLT". Save the project to a good location. (If multiple people need access, a central network location.)
Use the following to execute it as a command:
(defun C:SLT (/ fqnFile)
(vl-Load-Com)
(setq fqnFile (findfile "SLT.dvb")) ; find the VBA project
(vla-LoadDVB (vlax-Get-Acad-Object) fqnFile) ; load the project
(vla-RunMacro (vlax-Get-Acad-Object) "ResetPSLTScale")) ; execute the macro
(vl-Catch-All-Apply 'vla-UnloadDVB (list (vlax-Get-Acad-Object) fqnFile)) ; unload program
(princ "\nComplete."))
BTW, the Visual LISP code is untested as posted here. I hacked it from my working code.
pnorman
2005-05-19, 05:57 PM
Open the VBIDE. Place the code in the ThisDrawing object. Change the Project
You are the Man!!
Thanks
pnorman
2005-05-19, 06:47 PM
Here is another option:
From OLD-CADaver in ADN
Ohh, Try this completely untested
(defun c:vppltsc(/ THISTAB VPLST)
(setq THISTAB (getvar "CTAB"))
(foreach LAYOUT (layoutlist)
(setvar "CTAB" LAYOUT)
(setvar "psltscale" 0)
)
(setvar "CTAB" THISTAB)
(princ)
)
Robert.Hall
2005-05-19, 07:03 PM
Thanks for all your help, both VBA and Lisp work great! Kudos.
saf13562003
2005-05-26, 07:53 PM
[->PERSONAL PREFERENCE]
[<-STEVE FUQUA]^C^CSETVAR;PSLTSCALE;0;
add this to your mns file, you can add any setting you want ....
let me know how this works at saf13562003@yahoo.com
pnorman
2005-05-26, 07:59 PM
I think you will find that the whole idea was to aviod having to switch manually to each layout.
The macros posted change all layouts in a drawing with one command or button...
wolf0815
2009-01-15, 07:18 PM
I searched for a soltion of this problem - switching the PSLTSCALE on/off WITHOUT changing the layouts -
in this thread I found some parts of a lisp which worked partially, I now combined these to get the following program.
please answer if there is some bug or wrong idea!
yours
Wolfgang
(defun sw*set-psltscale-all (FLAG / LAYENT NEUELISTE)
(if (and FLAG
(member FLAG '(0 1))
)
(vlax-for LAYOUT
(vla-get-layouts
(vla-get-activedocument (vlax-get-acad-object))
)
(if (= (getvar "CTAB") (vla-get-Name LAYOUT))
(setvar "psltscale" FLAG)
(progn
(setq LAYENT (entget (vlax-vla-object->ename LAYOUT)))
(append!
'NEUELISTE
(reverse (member '(100 . "AcDbLayout") (reverse LAYENT)))
)
(foreach PAIR (cdr (member '(100 . "AcDbLayout") LAYENT))
(append! 'NEUELISTE
(if (= 70 (car PAIR))
(list (cons 70 FLAG))
(list PAIR)
)
)
)
(entmod NEUELISTE)
(entupd (vlax-vla-object->ename LAYOUT))
(setq NEUELISTE nil
LAYENT nil
)
)
)
)
)
)
(defun append!(symbol1 liste2 / )
(set symbol1(append(eval symbol1)liste2))
)
azarko
2009-01-16, 12:31 PM
Try it. Set PSLTSCALE=0 when change to layout tab. Simply load this code
(defun ChangeLayout (reactor layout)
(if (/= (nth 0 layout) "Model")
(progn
;;;Layuot
(setvar "psltscale" 0)
)
); if
)
(if
(not *LayoutReactor*)
(setq *LayoutReactor* (VLR-Miscellaneous-Reactor nil
'((:VLR-layoutSwitched . ChangeLayout))
)
)
)
I use this variant. It is possible to change LTSCALE and PSLTSCALE values under the requirements
(defun ChangeLayout (reactor layout)
;;; In model Space LTSCALE =0.5xDIMSCALE
;;; In layout space LTSCALE=0.5 PSLTSCALE=1
(if (= (nth 0 layout) "Model")
;;;ModeL Space
(setvar "ltscale"
(* (if (= (getvar "dimscale") 0)
1
; else
(getvar "dimscale")
); if
0.5
); *
)
(progn ;;;Layout tab
(setvar "ltscale" 0.5)
(setvar "psltscale" 1)
)
); if
)
(if
(not *LayoutReactor*)
(setq *LayoutReactor* (VLR-Miscellaneous-Reactor nil
'((:VLR-layoutSwitched . ChangeLayout))
)
)
)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.