Need Reactor or Event based auto plot to pdf (to specified folder) Only On Solid Touch on model space

Need Reactor or Event based auto plot to pdf (to specified folder) Only On Solid Touch on model space

SanjoyNath
Advocate Advocate
452 Views
1 Reply
Message 1 of 2

Need Reactor or Event based auto plot to pdf (to specified folder) Only On Solid Touch on model space

SanjoyNath
Advocate
Advocate

Dear Experts,

 

Please help

 

 

The solution is to work with reactor (or event on the model space when some solid is selected)

I need to read the AABB on view coordinate systems (That is UCS V) and do the plotting of the (any selected object with date time and user name to d drive folder(predefined)

 

 

 

Roadsmap

 

Step 1

to preserve current ucs and current rendered state of the graphics window

Step 2

to preserve current zoomed state of the screen

step 3

do the plotting of the solid object in conceptual rendered state (If the selected object is Autocad solid or Advance steel solid) with filename coming from user name , date time now and the solids  number , handle of the object

(Obviously to reset the preserved ucs , view orientation and the viewing rendering state as was there before plotting is done)

 

We need to do the plotting in low resolution to save time and space to plot.

 

Extending the below function with pdf plot only

 

 

 

(vl-load-com)
(defun c:Example_GetWindowToPlot()
;; This example allows the user to define an area in the current layout to plot
;; and displays a plot preview of the defined area.
;;
;; * Note: You will have to exit the plot preview
;; before the VBA example will stop and control will be returned
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))

;; Get first point in window
(setq point1 (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "Click the lower-left of the window to plot.")))

;; Change this to a 2D array by removing the Z position
(setq pointTemp1 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
(vlax-safearray-put-element pointTemp1 0 (vlax-safearray-get-element point1 0))
(vlax-safearray-put-element pointTemp1 1 (vlax-safearray-get-element point1 1))

;; Get second point in window
(setq point2 (vlax-variant-value (vla-GetCorner (vla-get-Utility doc) point1 "Click the upper-right of the window to plot.")))

;; Change this to a 2D array by removing the Z position
(setq pointTemp2 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
(vlax-safearray-put-element pointTemp2 0 (vlax-safearray-get-element point2 0))
(vlax-safearray-put-element pointTemp2 1 (vlax-safearray-get-element point2 1))

;; Send information about window to current layout
(vla-SetWindowToPlot (vla-get-ActiveLayout doc) pointTemp1 pointTemp2)

;; Read back window information
(vla-GetWindowToPlot (vla-get-ActiveLayout doc) 'point1 'point2)

(setq point1 (vlax-safearray->list point1)
point2 (vlax-safearray->list point2))

(alert (strcat "Press any key to plot the following window:"
"\nLower Left: " (rtos (nth 0 point1) 2) ", " (rtos (nth 1 point1) 2)
"\nUpper Right: " (rtos (nth 0 point2) 2) ", " (rtos (nth 1 point2) 2)))

;; Make sure the instruction is to plot a view, not some other plot style
(vla-put-PlotType (vla-get-ActiveLayout doc) acWindow)

;; Send Plot To Window - A plot device must be set before a preview can be created
(vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
)

Sanjoy Nath
BIM Manager And Digital Lead (Structures Online)
BOOST, AR , VR ,EPM,IFC API,PDF API , CAD API ,Revit API , Advance Steel API
Founder of Geometrifying Trigonometry(C)
0 Likes
453 Views
1 Reply
Reply (1)
Message 2 of 2

john.uhden
Mentor
Mentor

You seem to have a good start there.

Keep playing with it and I'm sure you'll figure it out.  That's what most all of us do.

Ya can't let skinned knees keep you from learning how to ride a bicycle.

John F. Uhden

0 Likes