+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Oct 2009
    Posts
    22

    Question Hideprecision set to 1 before plot?

    Registered forum members do not see this ad.

    How can i set hideprecision to 1 before i plot? then set it back to 0 after it plots? im told i could use a reactor but im not that far into my lsp skills yet, any help would be much appreciated!


    i just found this but i dont quite get it

    HTML Code:
    (defun CommandReactor (objReactor lstCommand)
     (cond
      ((= (car lstCommand) "PLOT")
       (print "\nDo stuff before plot: \n")
      )
     )
    )
    (setq rxnCommand ( vlr-editor-reactor nil '((:vlr-commandwillstart .  CommandReactor))))
    Last edited by mojo8997; 7th May 2010 at 12:30 am.

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,811

    Default

    Perhaps

    Code:
    (setvar 'HIDEPRECISION 1)
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Oct 2009
    Posts
    22

    Default

    well i have this but it not working
    HTML Code:
    (defun edgplotstart (objReactor lstCommand)
    (cond
    ((= (car lstCommand) "PLOT")
     (print "\n Hideprecision Set to 1")
    (setvar "hideprecision" 1)
    )
    )
    )
    (setq rxnCommand ( vlr-editor-reactor nil '((:vlr-commandwillstart . edgplotstart))))
    
    
    (defun edgplotend (objReactor lstCommand)
    (cond
    ((= (car lstCommand) "PLOT")
    (print "\n Hideprecision Set to 0")
     (setvar "hideprecision" 0)
    )
    )
    )
    (setq rxnCommand ( vlr-editor-reactor nil '((:vlr-commandended . edgplotend))))
    well i dont think its working


    HTML Code:
    Command: _plot
    "\nHideprecision Set to 1"
    "\nHideprecision Set to 1"
    "\nHideprecision Set to 0"
    "\nHideprecision Set to 1"
    "\nHideprecision Set to 0"
    "\nHideprecision Set to 1" Effective plotting area:  10.60 wide by 15.91 high
    Effective plotting area:  5.69 wide by 1.05 high
    
    Plotting viewport 2.
    Effective plotting area:  5.70 wide by 1.71 high
    
    Plotting viewport 3.
    
    Plotting viewport 1.
    
    "\nHideprecision Set to 0"

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,811

    Default

    Try this:

    Code:
    (defun c:HidePrecReactor nil
      (vl-load-com)
      ;; Lee Mac  ~  07.05.10
    
      (  (lambda ( data / 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)
               (vlr-add react)
             )
             (setq react
               (vlr-command-reactor data
                 (list
                   (cons :vlr-CommandWillStart 'SetHide)
                   (cons :vlr-CommandEnded     'RestoreHide)
                   (cons :vlr-CommandCancelled 'RestoreHide)
                 )
               )
             )
           )
           (princ
             (if (vlr-added-p react)
               "\n** Reactor Activated **"
               "\n** Reactor Deactivated **"
             )
           )
           react
         )
        "Prec-Reactor"
      )
    
      (princ)
    )
    
    (defun SetHide ( reactor params )
    
      (if (eq (strcase (car params)) "PLOT")
        (progn
          (setq oldHide (getvar 'HIDEPRECISION))      
          (setvar 'HIDEPRECISION 1)
          (princ (strcat "\n<< HIDEPRECISION set to 1 >>"))
        )
      )
      (princ)
    )
    
    (defun RestoreHide ( reactor params )
    
      (if (and oldHide (eq (strcase (car params)) "PLOT"))
        (progn
          (setvar 'HIDEPRECISION oldHide)
          (princ (strcat "\n<< HIDEPRECISION set to " (itoa oldHide) " >>"))
          (setq oldHide nil)
        )
      )
      (princ)
    )
    Turn on the reactor using HidePrecReactor (turn it on once), and turn it off with the same command.
    Last edited by Lee Mac; 7th May 2010 at 01:20 am.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #5
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Oct 2009
    Posts
    22

    Default

    nice!! man your badass, i was telling my friend about you lol (hes the one teaching me lisp)

    it is getting caught at here

    HTML Code:
    (and oldHide (eq (strcase (car params) "PLOT")))
    i changed it to

    HTML Code:
    (and oldHide (eq (strcase (car params)) "PLOT"))
    but something is still happening funny so i just made it

    HTML Code:
    (defun RestoreHide ( reactor params )
    
      (if (and oldHide (eq (strcase (car params)) "PLOT"))
        (progn
          (setvar 'HIDEPRECISION 0)
          (princ (strcat "\n<< HIDEPRECISION set to 0 >>"))
        )
      )
      (princ)
    )
    thanks a lot!!

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,811

    Default

    Registered forum members do not see this ad.

    Ahh nice one - I think I perhaps wrote it a bit too quick

    Thanks for the compliments

    Updated my original code to sort out that typo
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Plot filename and date at the end of each plot
    By sadhu in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 20th May 2010, 03:32 pm
  2. Plot Device/Plot Settings Tab
    By Rudbeckia in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 11th Mar 2010, 03:33 pm
  3. Changes to plot layout and plot file for publish
    By GliderRider in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 12th Mar 2009, 09:48 pm
  4. Plot with plot styles
    By Lucas_ in forum AutoCAD Beginners' Area
    Replies: 3
    Last Post: 23rd Jun 2008, 05:30 am
  5. plot file locations for batch plot?
    By Kate M in forum AutoCAD General
    Replies: 1
    Last Post: 29th Oct 2003, 09:43 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts