Reactor Help

Discussion in 'AutoCAD' started by Bratz2, Sep 11, 2003.

  1. Bratz2

    Bratz2 Guest

    Can anyone out there give me an example of how I can get the scale of a vport, and have a dimension style set up with a specific name. I already have a lisp routine for creating the dimensions, but I'd like it to check the viewport scale, and create the name of the dimesnion, based on that scale factor.
     
    Bratz2, Sep 11, 2003
    #1
  2. Bratz2

    Steve Jones Guest

    Bratz2

    Assuming no user input (if to be used with a reactor) the following will
    return the viewport scale, assuming all viewports are the same scale.

    (defun VPScale (/ *doc* *vports* *pspace* CurrSpace VP VPScale Scale)
    (setq *doc* (vla-get-activedocument (vlax-get-acad-object)))
    (setq CurrSpace (vla-get-MSpace *doc*))
    (if (= :vlax-false CurrSpace)
    (vla-put-MSpace *doc* :vlax-true)
    (setq Currspace nil)
    )
    (setq VP (vla-get-ActivePViewport *doc*))
    (setq VPScale (vla-get-customscale VP))
    (if CurrSpace
    (vla-put-MSpace *doc* :vlax-false)
    )
    (setq Scale (fix (/ 1 VPScale)))
    (princ (strcat "\nViewport scale = 1:" (rtos Scale 2 0)))
    (princ)
    )

    That dimension routine sounds interesting, any chance you could send me a
    copy?

    Steve

    Can anyone out there give me an example of how I can get the scale of a
    vport, and have a dimension style set up with a specific name. I already
    have a lisp routine for creating the dimensions, but I'd like it to check
    the viewport scale, and create the name of the dimesnion, based on that
    scale factor.
     
    Steve Jones, Sep 11, 2003
    #2
  3. Bratz2

    Bratz2 Guest

    I'm not sure if I can send you a copy, as it wasn't written by me. But I'll check with the individual, and see if it alright with them. I don't want to step on anyone's toes. I'm gonna try what you suggested, and see what happens. But one more question.... What if there are multiple viewports, then using reactors would not be the way to go, is that correct.
     
    Bratz2, Sep 11, 2003
    #3
  4. Bratz2

    Steve Jones Guest

    Depends on what you want to do really.
    If you want to create a dimstyle for a new viewport when it is created then
    a reactor is the tool for the job.
    If you don't mind a bit of user interface you could select the viewports
    manually & create a dimstyle to suit each one.
    What exactly is it you want to achieve?


    I'm not sure if I can send you a copy, as it wasn't written by me. But I'll
    check with the individual, and see if it alright with them. I don't want to
    step on anyone's toes. I'm gonna try what you suggested, and see what
    happens. But one more question.... What if there are multiple viewports,
    then using reactors would not be the way to go, is that correct.
     
    Steve Jones, Sep 11, 2003
    #4
  5. Bratz2

    Bratz2 Guest

    What if the routine created the dimension based on the current "Active" viewport, would that be the way to go? If so what would the result be if the user were in let's say, paperspace with no Active viewports, but still needed to generate a dimension scale?
     
    Bratz2, Sep 11, 2003
    #5
  6. Bratz2

    Bratz2 Guest

    "be
    careful when working within viewports a lot of things happen in between." Could you explain a bit more?
     
    Bratz2, Sep 11, 2003
    #6
  7. Bratz2

    Bratz2 Guest

    I'm trying to get it to create a dimension style based on the user being able to select any single viewport. My concern is... What if there is no viewport, or what if the user is in Modelspace already? If the user is still in Modelspace The if possible i'd like them to be able to type in a scale much like the routine I'm already using.
     
    Bratz2, Sep 11, 2003
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.