acad hispano
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

Apagar Grid en todos los Layout, viewports y model

4 participantes

Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Apagar Grid en todos los Layout, viewports y model

Mensaje por carlosmgilp Dom Mayo 01, 2016 9:06 am

Hola muchachos como están.

Disculpen, quería hacerles una consulta sobre como apagar el grid (F7) en todas las ventanas contando el model.

Es que hasta el día de hoy lo hacia con la variable (setvar "gridmode" 0) y funciona bien en el model, pero si entro al layout tengo que estar entrando a cada ventana, luego desactivarlo y volverme a salir de la ventana.

Como podría automatizar esta tarea.

Gracias.

carlosmgilp

Mensajes : 149
Fecha de inscripción : 17/03/2016
Edad : 42
Localización : Venezuela

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por devitg Miér Mayo 04, 2016 1:31 am

GRID es una propiedad , sigue las instrucciones de SAN HELP

Código:
GridOn Property (ActiveX)
 
 
 
Specifies the status of the viewport grid.

Supported platforms: Windows only

Signature
VBA:

object.GridOnobject
Type: PViewport, Viewport

The objects this property applies to.

Property Value
Read-only: No

Type: Boolean

True: The grid is on.
False: The grid is off.
Remarks
The grid is used only for visual reference. It is not plotted, nor is it considered part of the drawing. The grid origin is set by the SnapBasePoint method.

When the grid is turned on, it is set to the current grid spacing. To change the grid spacing, use the SetGridSpacing method.

When you turn the grid on or off on a viewport, the visibility of the grid will not change until the viewport is made active. If you toggle the grid of the active viewport, the visibility of the grid will not change until the viewport is reset as the active viewport. To set or reset the viewport as the active viewport, use the ActiveViewport property with the updated viewport object.

NoteThe value of this property is stored in the GRIDMODE system variable. When using the SetVariable method to update the grid mode of the active viewport, you do not have to reset the viewport as the active viewport to see the change.
Examples
VBA:

Sub Example_GridOn()
    ' This example toggles the setting of GridOn.
   
    Dim viewportObj As AcadViewport
   
    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

TOGGLEGRID:
    If MsgBox("Toggle the grid?", vbOKCancel, "GridOn Example") = vbOK Then
        viewportObj.GridOn = Not (viewportObj.GridOn)
    Else
        Exit Sub
    End If
   
    ' Reset the active viewport to see the change
    ThisDrawing.ActiveViewport = viewportObj
   
    GoTo TOGGLEGRID
   
End SubVisual LISP:

(vl-load-com)
(defun c:Example_GridOn()
    ;; This example toggles the setting of GridOn.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))   
   
    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    (vla-put-GridOn viewportObj (if (= (vla-get-GridOn viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change
    (vla-put-ActiveViewport doc viewportObj)
    (vla-Regen doc acAllViewports)
 
    (alert "Toggled the display of the grid.") 
)

devitg
Admin

Mensajes : 257
Fecha de inscripción : 16/03/2016
Edad : 75
Localización : CORDOBA ARGENTINA

https://acadhispano.foroargentina.net

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por devitg Miér Mayo 04, 2016 3:59 am

GRID es una propiedad , sigue las instrucciones de SAN HELP  

Código:
GridOn Property (ActiveX)
 
 
 
Specifies the status of the viewport grid.

Supported platforms: Windows only

Signature
VBA:

object.GridOnobject
Type: PViewport, Viewport

The objects this property applies to.

Property Value
Read-only: No

Type: Boolean

True: The grid is on.
False: The grid is off.
Remarks
The grid is used only for visual reference. It is not plotted, nor is it considered part of the drawing. The grid origin is set by the SnapBasePoint method.

When the grid is turned on, it is set to the current grid spacing. To change the grid spacing, use the SetGridSpacing method.

When you turn the grid on or off on a viewport, the visibility of the grid will not change until the viewport is made active. If you toggle the grid of the active viewport, the visibility of the grid will not change until the viewport is reset as the active viewport. To set or reset the viewport as the active viewport, use the ActiveViewport property with the updated viewport object.

NoteThe value of this property is stored in the GRIDMODE system variable. When using the SetVariable method to update the grid mode of the active viewport, you do not have to reset the viewport as the active viewport to see the change.
Examples
VBA:

Sub Example_GridOn()
    ' This example toggles the setting of GridOn.
    
    Dim viewportObj As AcadViewport
    
    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

TOGGLEGRID:
    If MsgBox("Toggle the grid?", vbOKCancel, "GridOn Example") = vbOK Then
        viewportObj.GridOn = Not (viewportObj.GridOn)
    Else
        Exit Sub
    End If
    
    ' Reset the active viewport to see the change
    ThisDrawing.ActiveViewport = viewportObj
    
    GoTo TOGGLEGRID
    
End SubVisual LISP:

(vl-load-com)
(defun c:Example_GridOn()
    ;; This example toggles the setting of GridOn.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))    
    
    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    (vla-put-GridOn viewportObj (if (= (vla-get-GridOn viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change
    (vla-put-ActiveViewport doc viewportObj)
    (vla-Regen doc acAllViewports)
  
    (alert "Toggled the display of the grid.")  
)

devitg
Admin

Mensajes : 257
Fecha de inscripción : 16/03/2016
Edad : 75
Localización : CORDOBA ARGENTINA

https://acadhispano.foroargentina.net

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por devitg Miér Mayo 04, 2016 3:59 am

perdón fue repetido

devitg
Admin

Mensajes : 257
Fecha de inscripción : 16/03/2016
Edad : 75
Localización : CORDOBA ARGENTINA

https://acadhispano.foroargentina.net

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por amc.dicsac Miér Mayo 04, 2016 4:36 pm

Hola que tal, auhmm otra solución seria que en el archivo acad20xxdoc.lsp crees tus variables configuradas por ejemplo:

Código:
(defun LoadVarrillaSetup ()
(setvar "insunits" 6)
(setvar "filedia" 1)
(setvar "mbuttonpan" 1)
(setvar "highlight" 1)
(setvar "fillmode" 1)
(setvar "maxactvp" 50)
(setvar "pickadd" 1)
(setvar "pickfirst" 1)
(setvar "lwdisplay" 0)
(setvar "psltscale" 0)
(setvar "ltscale" 1)
(setvar "gridmode" 0)
(setvar "mirrtext" 0))

Y al final agreges esta linea

Código:
(defun-q-list-set 'S::Startup (append (defun-q-list-ref 'S::Startup) '((LoadVarrillaSetup))))
(defun-q S::Startup nil (LoadVarrillaSetup))

Espero sea de utilidas saludos.
amc.dicsac
amc.dicsac

Mensajes : 83
Fecha de inscripción : 17/03/2016
Edad : 33
Localización : Lima - Perú

http://axprogramlisp.blogspot.pe/

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por carlosmgilp Miér Mayo 04, 2016 4:57 pm

Hola muchachos como están.

Lo que tengo es que investigar como recorrer todos los viewports y por cada uno que lo apague.

de todas maneras voy a revisar y ver que aplico.

Muchas gracias.

carlosmgilp

Mensajes : 149
Fecha de inscripción : 17/03/2016
Edad : 42
Localización : Venezuela

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por nolo Miér Mayo 04, 2016 5:53 pm

Prueba a ver si te sirve utilizar este lisp con los dos comandos que pongo al final, grion y grioff
Código:
(defun grid( i / old)
(setq old (mapcar 'getvar '(tilemode clayout)))
(mapcar '(lambda(a)(setvar 'clayout a)
 ;;; (mapcar 'setvar '(clayout gridmode)(list a i))
 (if (> (length(vports)) i)
 (progn
 (command "_.mspace")
 (foreach x (mapcar'(lambda(a)(list(car a)i))(vports))
 (if (/= (car x) 1) (mapcar 'setvar '(cvport gridmode) x) )
 )))
 (command "_.pspace")(setvar 'gridmode i)
)(layoutlist))
(setvar 'tilemode 1)
(foreach x (mapcar'(lambda(a)(list(car a)i))(vports))(mapcar 'setvar '(cvport gridmode) x))
(mapcar 'setvar '(tilemode clayout) old)
)

(defun c:grion() (setvar 'cmdecho 0)(grid 1)(setvar 'cmdecho 1)(princ))
(defun c:grioff() (setvar 'cmdecho 0)(grid 0)(setvar 'cmdecho 1)(princ))

Evidentemente, su rapidez dependerá de la velocidad de regeneración de los layout ..

Un saludo

nolo

Mensajes : 182
Fecha de inscripción : 17/03/2016

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por carlosmgilp Sáb Mayo 14, 2016 9:23 pm

Hola nolo como estas, disculpa la demora en responder, pues no tuve pc y se me complico todo.
Lo probare y cualquier cosa de ser necesario te comento.
Mil gracias y un saludo a todos.

carlosmgilp

Mensajes : 149
Fecha de inscripción : 17/03/2016
Edad : 42
Localización : Venezuela

Volver arriba Ir abajo

Apagar Grid en todos los Layout, viewports y model Empty Re: Apagar Grid en todos los Layout, viewports y model

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.