Are reactors the best solution?

Discussion in 'AutoCAD' started by DANACAD, Apr 13, 2004.

  1. DANACAD

    DANACAD Guest

    I am in the process of creating an autolisp program to create a symbols legend. I have it pretty much complete, but I am running into a problem. The problem I have is that we tend to have different size row heights dependent on what part is being depicted. For instance if one part has more options than another part. (Why make them all the same height, if you can skimp on space with the less elaborate parts?).
    The basic outline of my program is,

    Insert a header
    enter part number/verify/select options/insert block
    repeat until user selects "Done"

    If all of the rows were to be of the same height, I could just specify height@270 in an insert command.

    I first thought that I could list an object in the block that represents the height, and set that to a variable. Then I could still use the variable@270 in an insert command. However I thought I read somewhere that the handle gets redefined when it is inserted into another drawing.

    I then thought that I could use an event to trigger a function upon insertion of each symbols legend entry to list the length of a defined reactor. But, I can't find any good examples of the vlr-insert-reactor to see if this will do the trick. And I don't even know if I should define something in the block first.

    I have also come across information on extended data. I don't know if I attached extended data, and query that information, it would work.

    Any help would be appreciated, as I have only been programming AutoLisp for a month.
     
    DANACAD, Apr 13, 2004
    #1
  2. DANACAD

    Larry Travis Guest

    If you still have to create your blocks, or are willing to modify each of
    them, you could just add a invisible constant attribute to the block
    definition that states the amount of room that block takes up. Then your
    routine could just read that value. Simpler yet, you could always include
    the information as part of the name of the block itself (i.e. "symbol_1.5"
    to indicate the block takes up 1.5x the regular row height). Then you can
    just use some simple string manipulation to read the required info from the
    block name.

    I don't know of any easy way to acquire the space a block takes up other
    then to have the value explicity included as part of the block in ways such
    as indicated above. Even the standard Acad2005 "zoom to selected objects"
    command cannot even determine exactly how much space some objects (such as
    arcs) take up.

    Just ideas,
    LT

    legend. I have it pretty much complete, but I am running into a problem.
    The problem I have is that we tend to have different size row heights
    dependent on what part is being depicted. For instance if one part has more
    options than another part. (Why make them all the same height, if you can
    skimp on space with the less elaborate parts?).
    height@270 in an insert command.
    the height, and set that to a variable. Then I could still use the
    variable@270 in an insert command. However I thought I read somewhere that
    the handle gets redefined when it is inserted into another drawing.
    insertion of each symbols legend entry to list the length of a defined
    reactor. But, I can't find any good examples of the vlr-insert-reactor to
    see if this will do the trick. And I don't even know if I should define
    something in the block first.
    attached extended data, and query that information, it would work.
    for a month.
     
    Larry Travis, Apr 14, 2004
    #2
  3. DANACAD

    Mark Propst Guest

    what about using the boundingbox of previous and current insertions to
    calculate position required?
     
    Mark Propst, Apr 14, 2004
    #3
  4. DANACAD

    DANACAD Guest

    I searched the help files for "bounding box".

    It looks as though the bounding box is associated with text.

    This block has boundary lines on the right, left, and bottom, so would AutoCAD sense this?
     
    DANACAD, Apr 14, 2004
    #4
  5. DANACAD

    Larry Travis Guest

    Well I guess I am learning something new here! I just noticed that there is
    a boundingbox activeX method. Unfortunately, I have very little activeX
    experience and my previous reply just assumed the use of plain old "vanilla"
    autolisp. I am not very comfortable with VBA and I cannot seem to find any
    good help text regarding using this method in lisp. Would you care to
    enlighten me with an explanation or a little code example?

    LT
     
    Larry Travis, Apr 14, 2004
    #5
  6. DANACAD

    DANACAD Guest

    The blocks have been created, but I will have to visit each one at some time anyhow for other reasons, so that is not a problem.

    One of the big reasons that I thought reactors might be slick, is that if someone made a change to the height of the block, it would update itself.

    Perhaps I can use a reactor to update an invisible attribute. Then have it read by the program that is inserting it into the drawing.

    Thanks for the thoughts. If you have anything else, please let me know
     
    DANACAD, Apr 14, 2004
    #6
  7. DANACAD

    Jeff Mishler Guest

    Yes, using ActiveX.

    Look into the ActiveX and VBA Developer's Guide for the GetBoundingBox
    method.

    (setq blockEnt (vlax-ename->vla-object (entlast)))
    (vlax-invoke blockent "getboundingbox" "lowleft" "upright")

    The variables lowleft and upright will contain the lowerleft and
    upperright WCS coordinates of the bounding box.

    HTH,
    Jeff

    AutoCAD sense this?
     
    Jeff Mishler, Apr 14, 2004
    #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.