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

Crear Pagesetup

2 participantes

Ir abajo

Crear Pagesetup Empty Crear Pagesetup

Mensaje por amc.dicsac Lun Sep 12, 2016 7:51 pm

Hola que tal, tengo una consulta, se puede crear un pagesetup por medio de lisp.
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

Crear Pagesetup Empty Re: Crear Pagesetup

Mensaje por saulo2016 Mar Sep 13, 2016 2:41 pm

Ahorita yo no tengo ni idea, pero esta buena esa idea, habria que diseñar algo....si no es que ya algien hizo algo de esto...

Saludos
saulo2016
saulo2016

Mensajes : 210
Fecha de inscripción : 17/03/2016
Edad : 58
Localización : Monterrey, Nuevo León, Mexico

Volver arriba Ir abajo

Crear Pagesetup Empty Re: Crear Pagesetup

Mensaje por saulo2016 Mar Sep 13, 2016 2:56 pm

Mira me anduve paseando por Internet un ratito y me encontre con esto....parece ser que hace lo que tu preguntaste.

checalo


Codigo:
Código:
(defun c:CustomPageSetup ()
  ;; Get the current drawing
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  ;; Get the PlotConfigurations collection
  (setq plotCfgs (vla-get-PlotConfigurations doc))

  ;; Check to see if the pagesetup already exists
  (setq plotCfg
 (vl-catch-all-apply 'vla-Item (list plotCfgs "MYPAGESETUP"))
  )

  ;; If the page setup exists, the variable will be of type VLA-OBJECT
  (if (/= (type plotCfg) 'VLA-OBJECT)
    ;; Create a page setup for model or paper space accordingly
    (if (= (getvar "TILEMODE") 0)
      (setq plotCfg (vla-Add plotCfgs "MYPAGESETUP" :vlax-false))
      (setq plotCfg (vla-Add plotCfgs "MYPAGESETUP" :vlax-true))
    )
  )

  ;;(vla-put-Name plotCfg "MYPAGESETUP")
  (vla-RefreshPlotDeviceInfo plotCfg)

  ;; Set the plot device
  (vla-put-ConfigName plotCfg "DWF6 ePlot.pc3")

  ;; Set the paper size
  (vla-put-CanonicalMediaName
    plotCfg
    "ANSI_C_(22.00_x_17.00_Inches)"
  )

  ;; Set the plot units (inches, millimeters, pixels)
  (vla-put-PaperUnits plotCfg acInches)

  ;; Set what to plot
  ;; - If using acView, set the ViewToPlot property
  ;; - If using acWindow, call GetWindowToPlot
  (if (= (getvar "TILEMODE") 0)
    (progn
      (vla-put-PlotType plotCfg acLayout)

      ;; Set scale
      (vla-put-UseStandardScale plotCfg :vlax-true)
      (vla-put-StandardScale plotCfg ac1_1)
    )
    (progn
      (vla-put-PlotType plotCfg acExtents)

      ;; Set scale
      (vla-put-UseStandardScale plotCfg :vlax-true)
      (vla-put-StandardScale plotCfg acScaleToFit)

      ;; Center the plot on the page
      (vla-put-CenterPlot plotCfg :vlax-true)
    )
  )

  ;; Hide paperspace objects
  (vla-put-PlotHidden plotCfg :vlax-false)

  ;; Set the plot origin
  (setq origin (vlax-make-safearray vlax-vbDouble '(0 . 1)))
  (vlax-safearray-fill origin (list 0.5 0.5))
  (vla-put-PlotOrigin plotCfg origin)

  ;; Set the plot rotation
  (vla-put-PlotRotation plotCfg ac0degrees)

  ;; Set viewport plot behavior
  (vla-put-PlotViewportBorders plotCfg :vlax-false)
  (vla-put-PlotViewportsFirst plotCfg :vlax-true)

  ;; Set lineweight behavior
  (vla-put-PlotWithLineweights plotCfg :vlax-true)
  (vla-put-ScaleLineweights plotCfg :vlax-true)

  ;; Set plot styles behavior
  (vla-put-PlotWithPlotStyles plotCfg :vlax-true)
  (vla-put-ShowPlotStyles plotCfg :vlax-true)

  (if (= (getvar "PSTYLEMODE") 0)
    (vla-put-StyleSheet plotCfg "acad.stb")
    (vla-put-StyleSheet plotCfg "acad.ctb")
  )

  ;; Assign the page setup to the current layout
  (vla-CopyFrom (vla-get-ActiveLayout doc) plotCfg)
)



Saludos
saulo2016
saulo2016

Mensajes : 210
Fecha de inscripción : 17/03/2016
Edad : 58
Localización : Monterrey, Nuevo León, Mexico

Volver arriba Ir abajo

Crear Pagesetup Empty Re: Crear Pagesetup

Mensaje por amc.dicsac Jue Sep 15, 2016 12:12 am

saulo2016 escribió:Mira me anduve paseando por Internet un ratito y me encontre con esto....parece ser que hace lo que tu preguntaste.

checalo


Codigo:
Código:
(defun c:CustomPageSetup ()
  ;; Get the current drawing
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  ;; Get the PlotConfigurations collection
  (setq plotCfgs (vla-get-PlotConfigurations doc))

  ;; Check to see if the pagesetup already exists
  (setq plotCfg
 (vl-catch-all-apply 'vla-Item (list plotCfgs "MYPAGESETUP"))
  )

  ;; If the page setup exists, the variable will be of type VLA-OBJECT
  (if (/= (type plotCfg) 'VLA-OBJECT)
    ;; Create a page setup for model or paper space accordingly
    (if (= (getvar "TILEMODE") 0)
      (setq plotCfg (vla-Add plotCfgs "MYPAGESETUP" :vlax-false))
      (setq plotCfg (vla-Add plotCfgs "MYPAGESETUP" :vlax-true))
    )
  )

  ;;(vla-put-Name plotCfg "MYPAGESETUP")
  (vla-RefreshPlotDeviceInfo plotCfg)

  ;; Set the plot device
  (vla-put-ConfigName plotCfg "DWF6 ePlot.pc3")

  ;; Set the paper size
  (vla-put-CanonicalMediaName
    plotCfg
    "ANSI_C_(22.00_x_17.00_Inches)"
  )

  ;; Set the plot units (inches, millimeters, pixels)
  (vla-put-PaperUnits plotCfg acInches)

  ;; Set what to plot
  ;; - If using acView, set the ViewToPlot property
  ;; - If using acWindow, call GetWindowToPlot
  (if (= (getvar "TILEMODE") 0)
    (progn
      (vla-put-PlotType plotCfg acLayout)

      ;; Set scale
      (vla-put-UseStandardScale plotCfg :vlax-true)
      (vla-put-StandardScale plotCfg ac1_1)
    )
    (progn
      (vla-put-PlotType plotCfg acExtents)

      ;; Set scale
      (vla-put-UseStandardScale plotCfg :vlax-true)
      (vla-put-StandardScale plotCfg acScaleToFit)

      ;; Center the plot on the page
      (vla-put-CenterPlot plotCfg :vlax-true)
    )
  )

  ;; Hide paperspace objects
  (vla-put-PlotHidden plotCfg :vlax-false)

  ;; Set the plot origin
  (setq origin (vlax-make-safearray vlax-vbDouble '(0 . 1)))
  (vlax-safearray-fill origin (list 0.5 0.5))
  (vla-put-PlotOrigin plotCfg origin)

  ;; Set the plot rotation
  (vla-put-PlotRotation plotCfg ac0degrees)

  ;; Set viewport plot behavior
  (vla-put-PlotViewportBorders plotCfg :vlax-false)
  (vla-put-PlotViewportsFirst plotCfg :vlax-true)

  ;; Set lineweight behavior
  (vla-put-PlotWithLineweights plotCfg :vlax-true)
  (vla-put-ScaleLineweights plotCfg :vlax-true)

  ;; Set plot styles behavior
  (vla-put-PlotWithPlotStyles plotCfg :vlax-true)
  (vla-put-ShowPlotStyles plotCfg :vlax-true)

  (if (= (getvar "PSTYLEMODE") 0)
    (vla-put-StyleSheet plotCfg "acad.stb")
    (vla-put-StyleSheet plotCfg "acad.ctb")
  )

  ;; Assign the page setup to the current layout
  (vla-CopyFrom (vla-get-ActiveLayout doc) plotCfg)
)



Saludos

Hola "saulo2016" gracias por la respuesta, por mi cuenta la manera que lo solucione momentaneamente fue importando las pagesetup de un cad mediante este lisp al que le agrege algunas opciones.

Código:
(vl-load-com)

 (defun deleteAllPageSetups ()
 (vlax-for pc (vla-get-plotconfigurations (vla-get-activedocument (vlax-get-acad-object)))
 (vla-delete pc)))

(defun putPagesetup (layout setup / layouts plots)
 (defun item-p (collection item)
  (if
  (not
    (vl-catch-all-error-p
    (vl-catch-all-apply
      '(lambda () (setq item (vla-item collection item))))))
  item
  )
  )
 (and
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *doc*  (setq *doc*  (vla-get-activedocument *acad*)))
  (setq layouts (vla-get-layouts *doc*))
  (setq plots  (vla-get-plotconfigurations *doc*))
  (setq layout (item-p layouts layout))
  (setq setup (item-p plots setup))
  (not (vla-copyfrom layout setup))))

(defun massoc (key alist / x nlist)
(foreach x alist
(if (eq key (car x))
(setq nlist (cons (cdr x) nlist))))
(reverse nlist))


; Return: list of all pagesetups defined in the current drawing or nil
(defun getPagesetups ()
 (massoc 3 (dictsearch (namedobjdict) "Acad_PlotSettings")))

(defun c:P1 (/ lst page Save_Expert total_setup)
(if (not opcpstt) (setq opcpstt "Repetir"))
(initget "Importar Repetir Todo Eliminar")
(setq opcpstt (cond ((getkword (strcat "\nIngresa la opcion [ Importar/Repetir/Todo/Eliminar ] <" opcpstt ">: ")))
( opcpstt )))
(cond
((= opcpstt "Importar")
(setq Save_Expert (getvar "EXPERT"))
(setvar "EXPERT" 2)
(setq total_setup (strcase (getstring T "\nImportar cantidad de Pagesetup: ")))
(command "_.-PSETUPIN" "C:/Program Files/AutoCAD 2008/Support/CADMASTER 2008/BLOCKS-50/Insertar/PageSetup8-A0.dwg" total_setup "")
(setvar "EXPERT" Save_Expert)
;;--------------------------------------------------------------------
(setq lst (mapcar 'strcase (getPagesetups)))
(while (not page)
(setq page (strcase (getstring T "\nIngresa pagesetup current: ")))
(if (or (= "" page) (not (member page lst)))
(progn (alert "\nPagesetup no encotrada..") (setq page nil))))
;;--------------------------------------------------------------------
(foreach x (layoutlist) (putPagesetup x page))
(putPagesetup (getvar "ctab") page)
(command "regen")
;;(command "_preview")
(princ))

((= opcpstt "Todo")
(setq lst (mapcar 'strcase (getPagesetups)))
(while (not page)
(setq page (strcase (getstring T "\nCantidad Total de Pagesetup: ")))
(if (or (= "" page) (not (member page lst)))
(progn (alert "\nPagesetup no encotrada..") (setq page nil))))
;;--------------------------------------------------------------------
(foreach x (layoutlist) (putPagesetup x page))
(putPagesetup (getvar "ctab") page)
(setq Numeros (+ (atoi page) 0))
(setq cantidad 1)
 (repeat Numeros
  (command "._-plot" "N" "" cantidad "HP Designjet T520 36in HPGL2" "N" "Y" "Y")
  (setq cantidad (+ cantidad 1))
 )
(princ))

((= opcpstt "Eliminar")
(deleteAllPageSetups)
(prompt "\n- Se eliminaron todos las pagesetup...")
(princ))

((= opcpstt "Repetir")
(setq lst (mapcar 'strcase (getPagesetups)))
(while (not page)
(setq page (strcase (getstring T "\nIngresa numero de Pagesetup: ")))
(if (or (= "" page) (not (member page lst)))
(progn (alert "\nPagesetup no encotrada..") (setq page nil))))
;;--------------------------------------------------------------------
(foreach x (layoutlist) (putPagesetup x page))
(putPagesetup (getvar "ctab") page)
(command "regen")
(setq pe1 (cond ((getint (strcat "\nIngresa cantidad de copias: <" (itoa (setq pe1 (cond ( pe1 ) ( 1 )))) ">: "))) ( pe1 )))
(repeat pe1
(command "_plot" "" "" "" "" "" "" ""))))
(princ))

Por otro lado estoy tratando de adecuar el codigo que subiste. ya que no manejo mucho los "vla"

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

Crear Pagesetup Empty Re: Crear Pagesetup

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.