| Правила | Регистрация | Пользователи | Сообщения за день |  Справка по форуму | Файлообменник |

Вернуться   Форум DWG.RU > Программное обеспечение > Программирование > LISP > Цикл печати изображений в файл, через Лисп

Цикл печати изображений в файл, через Лисп

Ответ
Поиск в этой теме
Непрочитано 31.10.2010, 19:02 #1
Цикл печати изображений в файл, через Лисп
proektant-minsk
 
Проектировщик ОВ
 
Минск
Регистрация: 15.10.2010
Сообщений: 42

Задача следущая. Необходимо автоматически при помощи лиспа, напечатать в файл, данну облость пространства модели n раз, то есть в папке долны будут находится файлы 0001.jpg ... 0100.jpg. И вообще как при помощи лиспа печатать в файл, с определенными настройками... не используя command???
Просмотров: 2911
 
Непрочитано 01.11.2010, 08:21
#2
Do$

AutoCAD/Civil3D LISP/C#
 
Регистрация: 15.08.2008
Санкт-Петербург
Сообщений: 1,702
Отправить сообщение для Do$ с помощью Skype™


Vla- методами. Смотри методы PlotToFile, PlotToDevice.
Do$ вне форума  
 
Непрочитано 01.11.2010, 10:53
#3
Кулик Алексей aka kpblc
Moderator

LISP, C# (ACAD 200[9,12,13,14])
 
Регистрация: 25.08.2003
С.-Петербург
Сообщений: 39,846


Я бы подумал об использовании не-AutoCAD
__________________
Моя библиотека lisp-функций
---
Обращение ко мне - на "ты".
Все, что сказано - личное мнение.
Кулик Алексей aka kpblc вне форума  
 
Автор темы   Непрочитано 01.11.2010, 21:02
#4
proektant-minsk

Проектировщик ОВ
 
Регистрация: 15.10.2010
Минск
Сообщений: 42


Не автокад? Интересно, и какую альтернативу вы бы мне предложили... автокад я знаю неплохо, а изучать другие программы, стоит ли? Тем более я считаю что в автокаде можно решить любую задачу... и математического характера , и характера геометрического.

"Vla- методами. Смотри методы PlotToFile, PlotToDevice." - ну да, ну да, а как иначе...(((
proektant-minsk вне форума  
 
Непрочитано 01.11.2010, 22:15
#5
Кулик Алексей aka kpblc
Moderator

LISP, C# (ACAD 200[9,12,13,14])
 
Регистрация: 25.08.2003
С.-Петербург
Сообщений: 39,846


Если честно, я начальную задачу понял как "распечатать несколько файлов в jpg", причем эти файлы не факт что dwg. А так - ну вставлять их последовательно как внешнюю ссылку в текущий файл, отправлять на печать и отключать ссылку. Тоже вариант
__________________
Моя библиотека lisp-функций
---
Обращение ко мне - на "ты".
Все, что сказано - личное мнение.
Кулик Алексей aka kpblc вне форума  
 
Автор темы   Непрочитано 01.11.2010, 23:45
#6
proektant-minsk

Проектировщик ОВ
 
Регистрация: 15.10.2010
Минск
Сообщений: 42


Спасибо , Кулик. Я не совсем полностью указал цели, которые тут приследовал. Но PlotToFile, как я сейчас понимаю, для меня наилучшее решение. Считаю тему закрытой.
proektant-minsk вне форума  
 
Непрочитано 01.11.2010, 23:46
#7
Кулик Алексей aka kpblc
Moderator

LISP, C# (ACAD 200[9,12,13,14])
 
Регистрация: 25.08.2003
С.-Петербург
Сообщений: 39,846


Мне кажется (именно кажется!), что PlotToFile - не совсем то, что надо. Получишь на выходе plt-файл, и чего с ним делать дальше?
__________________
Моя библиотека lisp-функций
---
Обращение ко мне - на "ты".
Все, что сказано - личное мнение.
Кулик Алексей aka kpblc вне форума  
 
Непрочитано 26.09.2012, 20:30
#8
VVA

Инженер LISP
 
Регистрация: 11.05.2005
Минск
Сообщений: 6,992


Набрел на интересную статью Plotting and Creating Page Setups with AutoLISP

Plotting and Creating Page Setups with AutoLISP



Plotting is a key step in communicating your design with non-AutoCAD users unless you are using AutoCAD WS or another way of hosting your designs for others to see. While many users go straight to the PLOT command and never bother with page setups, page setups can make plotting a drawing much more consistent and easier if you need to plot your designs at different sizes or formats. One reason to plot the same layout or design at different sizes might be for a check plot and the other to a specific scale.

Note: This article does not work for those using AutoCAD for Mac because it does not support ActiveX.

The following demonstrates how to plot a layout using a PC3 file. It first checks to see if a PC3 file is assigned to the current layout for plotting, and if not it assigns the DWF6 ePlot.pc3 file as the current plot device. Using this same approach, you could plot all layouts in a drawing to PDF or DWF files without changing the current plot configuration, much like the way the PUBLISH command works.

Код:
[Выделить все]
 (vl-load-com)
(defun c:QDWF( / doc)
    ;; Get the current drawing
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
 
    ;; Plot the current layout
    (vla-PlotToDevice (vla-get-Plot doc) "DWF6 ePlot.pc3")
  (princ)
)
 
The vla-PlotToDevice function above is passed a valid PC3 file, but if you do not pass a PC3 file to the method it will use the plot device assigned to the layout which can be accessed with the vla-get-ConfigName function.

Note: The vla-PlotToDevice function will start plotting in the background or foreground based on the current value of the BACKGROUNDPLOT system variable.

Now that you see how to plot a single layout, you can plot multiple layouts using the vla-SetLayoutsToPlot function.
Код:
[Выделить все]
 
(defun c:PLOTALL( / doc)
    ;; Get the current drawing
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
 
    (setq lstLayouts nil
          arSize 0)
 
    (vlax-for layout (vla-get-layouts doc)
        ;; Check to see if a plot device is assigned to the layout, if not it will not be plotted
        (if (and
                (/= (strcase (vla-get-ConfigName layout)) "NONE")
                (= (vla-get-ModelType layout) :vlax-false)
            )
            (progn
                (if (= lstLayouts nil)
                    (setq lstLayouts (list (vla-get-Name layout)))
                    (setq lstLayouts (append lstLayouts (vla-get-Name layout)))
                )
            )
        )
    )
 
    ;; Create an array for all the layouts to be plotted
    (setq arLayouts (vlax-make-safearray vlax-vbString (cons 0 (1- (length lstLayouts)))))
 
    ;; Add the layout names to the array
    (foreach item lstLayouts
        (progn
            (vlax-safearray-put-element arLayouts arSize item)
            (setq arSize (1+ arSize))
        )
    )
 
    ;; Plot the layout to the device
    (vla-SetLayoutsToPlot (vla-get-Plot doc) arLayouts)
    (vla-PlotToDevice (vla-get-Plot doc))
 
  (princ)
)
The following demonstrates how to create a named page setup, and then assign it to the current layout.

Код:
[Выделить все]
 (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)
)
Hope you enjoyed the sample code.

Sincerely,
Lee
__________________
Как использовать код на Лиспе читаем здесь
VVA вне форума  
Ответ
Вернуться   Форум DWG.RU > Программное обеспечение > Программирование > LISP > Цикл печати изображений в файл, через Лисп

Размещение рекламы


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Вес линии и стиль печати Barbi AutoCAD 22 26.04.2012 17:56
Сохранить файл в формате dwg через COM-интерфейс AutoCAD'а S32 Программирование 4 18.09.2009 00:20
Проблема при печати в PDF через "DWG TO PDF Bonus Pack" Griz AutoCAD 14 09.07.2009 02:28
Как открыть файл через меню Автокада????? Владлен AutoCAD 1 31.10.2007 23:44
Ошибка при печати через SheetSetManager sqr(max) AutoCAD 5 10.10.2007 11:09