Jump to content

Modifications to Plot Reactor


woodman78

Recommended Posts

Hi all,

I have these lisp from Alan J Thompson that includes a plot reactor from LeeMac that functions brilliantly.

 

;Based on PageSetups from Alan J. Thompson
(defun c:A3 ()
(command "_.-layer" "_LW" "0.13" "CCC_LAYOUT_Dimensions" "")
(PlotReactorOFF)
 (if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
   (progn
     (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A3")
     (while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
       (command "_yes")
     ) ;_ while
     T
   ) ;_ progn
 ) ;_ if
(command "-plot" "n" "" "A3" "" "n" "y" "n")
(command "_-purge" "a" "*" "N")
(setq CCC_Sheet "A3")
(command "updatefield" "all" "")
(command "regenall")
(command "_zoom" "e")
 (initdia)
 (command "._plot")
(PlotReactorON)
;(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun PlotReactorON nil
 (vl-load-com)
 ;; © Lee Mac 2010

 (  (lambda ( data foo / react )
      (if (setq react
            (vl-some
              (function
                (lambda ( reactor )
                  (if (eq data (vlr-data reactor)) reactor)
                )
              )
              (cdar
                (vlr-reactors :vlr-command-reactor)
              )
            )
          )
        (if (not (vlr-added-p react))
          (vlr-add react)
        )
        (setq react
          (vlr-command-reactor data
            (list
              (cons :vlr-commandwillstart foo)
            )
          )
        )
      )
      (if (vlr-added-p react)
        (princ "\n** Reactor Activated **")
        (princ "\n** Reactor Failed to Activate **")
      )
      react
    )
   "Plot-Reactor"
   'Plot-Callback
 )

 (princ)
)

(defun PlotReactorOFF nil
 (vl-load-com)
 ;; © Lee Mac 2010

 (  (lambda ( data foo / react )
      (if (setq react
            (vl-some
              (function
                (lambda ( reactor )
                  (if (eq data (vlr-data reactor)) reactor)
                )
              )
              (cdar
                (vlr-reactors :vlr-command-reactor)
              )
            )
          )
        (if (vlr-added-p react)
          (vlr-remove react)
        )
      )
      (if (or (not react) (not (vlr-added-p react)))
        (princ "\n** Reactor Deactivated **")
        (princ "\n** Reactor Failed to Deactivate **")
      )
      react
    )
   "Plot-Reactor"
   'Plot-Callback
 )
 
 (princ)
)

(defun Plot-Callback ( reactor arguments )
 (vl-load-com)

 (if (eq (strcase (car arguments)) "PLOT")
   (LM:Popup "Warning" 64 "Gotcha!!!   Please use the NNRDO Plot tools when plotting standard layouts!!")
 )

 (princ)
)

(defun LM:Popup ( title flags msg / WSHShell result )
 ;; © Lee Mac 2010
 (setq WSHShell (vlax-create-object "WScript.Shell"))
 (setq result   (vlax-invoke WSHShell 'Popup msg 0 title flags))
 (vlax-release-object WSHShell)
 
 result
)

 

 

However, I would like to modify it to do the following. I have the "Use paper space units for scaling" box checked on in our standard template which is what I need for our service drawings. However this makes lining drawings look wrong when printed because dashes for road lining appear too short.

 

I would like to be able to test to see if the attribute TAGD2 within the block "CCC_Drawing_Types" is set to LS and then check if the "Use paper space units for scaling" is checked. If so invoke a dialog box telling the user to uncheck it and the launch the LT dialog box and when they click ok to resume with the plot window.

 

I know it sounds like I have my ideas sorted out but I have no idea where to begin. I found one of LeeMac's lisp to extract an attibute from a block but I don't know how to incorporate it.

 

(defun c:sk (/ dxf ent)

 (defun dxf (code ent) (cdr (assoc code (entget ent))))

 (if (and (setq ent (car (entsel "\nSelect an Attributed Block: ")))
          (eq "INSERT" (dxf 0 ent))
          (= 1 (dxf 66 ent)))

   (while (not (eq "SEQEND" (dxf 0 (setq ent (entnext ent)))))
     (princ (strcat "\n\nAtt_Tag:" (dxf 2 ent) "\nAtt_Value: " (dxf 1 ent)))))

 (princ)) 

 

I would appreciate any help on this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...