vla-get-documents

Discussion in 'AutoCAD' started by rewilson, Feb 12, 2004.

  1. rewilson

    rewilson Guest

    I need to search all open drawings for the presence of an image attachment, and if it's nil execute an _iunload command.
    I'm a little confused as to the correct approach to take. I can't get vla-get-documents to work the way I want. It always does the _iunload, even if it finds an image on one of the drawings. Any suggestions? BTW, this is for 2K4 w/rasterdesign 4. TIA.
     
    rewilson, Feb 12, 2004
    #1
  2. rewilson

    Devin Guest

    Are you using something like this?

    (vlax-for doc (vla-get-documents (vlax-get-acad-object))
    ;your code for checking image goes here
    )

    Perhaps you could elaborate a little on your current code and/or what
    exactly it is you're doing?

    Devin
     
    Devin, Feb 12, 2004
    #2
  3. rewilson

    rewilson Guest

    Just trying to conserve seats of rasterdesign.........once you invoke a command in rd4, the license is used until you exit AutoCAD. Sounds silly, but I don't really expect to be able to get the users to restart AutoCAD just because they're finished with the raster drawing. I've got......
    (vlax-for doc (vla-get-documents (vlax-get-acad-object))
    (setq a (ssget "x" '((0 . "image"))))

    (if (= a nil)
    (progn
    (command "_iunload")
    )
    )
    This does the unload, but unloads it even if there's an image attached. So there's something missing, and I can't figure it out. Beyond my skills (which isn't saying much). Thanks for you help.
     
    rewilson, Feb 12, 2004
    #3
  4. rewilson

    Devin Guest

    Please help me understand, if I understand you right then you have multiple
    seats of AutoCAD accessing a single seat of raster design? And the raster
    design locks to the user currently using it until he exits autocad
    completely? Causing other users to not be able to use the raster design
    seat until the previous user of it exits completely out of CAD?

    Devin
     
    Devin, Feb 12, 2004
    #4
  5. rewilson

    rewilson Guest

    Close.......I have multiple seats of RasterDesign 4 (30+) with approx. 50 users. I can't have someone tying up a license for the entire day, so my thought is "if they don't need it, unload it". Is this a bad idea from your point of view?
     
    rewilson, Feb 12, 2004
    #5
  6. rewilson

    rewilson Guest

    Let me clarify..........approx 50 seats of AutoCad. Some people in the company never use the RasterDesign 4, but if they should click on a menu item by mistake, they take a license away from someone who needs it.
     
    rewilson, Feb 12, 2004
    #6
  7. rewilson

    Jeff Mishler Guest

    The problem is that you can't use ssget on a drawing that isn't current,
    and you can't switch active drawings with lisp and still have the lisp
    continue. So here's on way to check the modelspace of the open docs for
    an image:

    (vlax-for doc (vla-get-documents (vlax-get-acad-object))
    (setq a nil)
    (vlax-for ent (vla-get-modelspace doc)
    (if (= (vla-get-objectname ent) "AcDbRasterImage")
    (setq a t)
    )
    )
    (if (= a nil)
    (alert "no images")
    (alert "image")
    )
    )

    HTH,
    Jeff

    company never use the RasterDesign 4, but if they should click on a menu
    item by mistake, they take a license away from someone who needs it.
     
    Jeff Mishler, Feb 12, 2004
    #7
  8. rewilson

    Devin Guest

    I'm not sure how your software license reads, you'll have to work that out
    with AutoDesk, but I think the software should only be installed on the
    computers that have a license for it. But I'm unfamiliar with those types
    of licenses so I may be in error. Maybe the moderator could give us a heads
    up on this one?
     
    Devin, Feb 12, 2004
    #8
  9. rewilson

    Doug Broad Guest

    Devin,
    He apparently has a network license and is trying to
    come up with an automatic way of checking the
    network licenses back in based on their use.
    Lets assume he's legal and not worry about that issue.
     
    Doug Broad, Feb 12, 2004
    #9
  10. rewilson

    rewilson Guest

    Thanks Jeff....I'll try it out.
     
    rewilson, Feb 12, 2004
    #10
  11. rewilson

    rewilson Guest

    That's exactly what I'm doing Doug.......thanks for the input.
     
    rewilson, Feb 12, 2004
    #11
  12. rewilson

    rewilson Guest

    Really......really confused. First we say
    (setq a nil)
    Then we say
    (setq a t)
    Then
    (if (= a nil)
    (alert "no images")
    This works fine....but I don't understand where to issue the iunload command. I've tried it at (setq a t) and also at (if(=a nil)
    and it always unloads the rasterdesign. Even if it finds an image. What am I doing wrong?TIA
     
    rewilson, Feb 12, 2004
    #12
  13. rewilson

    Devin Guest

    So then is he running an application server with the software and has a set
    number of application threads? Please have patience with me as I don't
    fully understand these things and in the spirit of growth would like to
    better understand.

    Devin
     
    Devin, Feb 12, 2004
    #13
  14. rewilson

    Jeff Mishler Guest

    Actually, I'd do it slightly different.... ;-)
    I setq a to nil in the beginning to make sure it is nil. Then, in the
    test for an Image IF one is found then a gets set to t. If none are
    found, a remains nil.
    My sample works for the alerts, but to do what you are doing, I'd change
    the (if statement to this:

    (if a
    (princ "\nImage found in drawing...");this prints to command line if
    image found, a is not nil
    (command "_iunload");this executes if no images found, a is nil
    )

    On another thought, since I don't have RasterDesign I can't verify this,
    but if RasterDesign is an arx file I believe it is loaded only once per
    acad session and works in all open drawings. So when you are issuing the
    "iunload" command it is doing so for the AUTOCAD session, NOT the
    individual drawing.

    You may need to re-think how to accomplish what you want......

    Jeff


    command. I've tried it at (setq a t) and also at (if(=a nil)
    What am I doing wrong?TIA
     
    Jeff Mishler, Feb 12, 2004
    #14
  15. rewilson

    rewilson Guest

    That's correct Devin. And as I said, we have a number of people that will never see a raster drawing (hybrid). But if they for some reason should execute a command, even if by accident, they have consumed a seat until they exit completely out of AutoCad. Since it is off a license server, everyone's installation is exactly the same. They even have access to the exact same block libraries. This helps with keeping everything standard throughout the company. HTH
     
    rewilson, Feb 12, 2004
    #15
  16. rewilson

    Doug Broad Guest

    I can't see how the presence of an image in an autocad
    drawing indicates that the user needs raster design for
    what he is currently doing.

    I also can't see how the lack of an image in the autocad
    documents means that the user does not need raster design.
    He could be just getting ready to us the raster design
    capabilities.

    It seems more appropriate to track raster design command
    use rather than the presence of images in the documents.
    Instead of automatically issuing an unload command, it
    would also seem more appropriate to start nagging the
    user who hasn't used a rasterdesign command for 15 minutes
    to unload it himself.

    Hope that helps. Since I don't have the product, can't
    be much help.



    nil execute an _iunload command.
    to work the way I want. It always does the _iunload, even if it finds an image on one of
    the drawings. Any suggestions? BTW, this is for 2K4 w/rasterdesign 4. TIA.
     
    Doug Broad, Feb 12, 2004
    #16
  17. rewilson

    rewilson Guest

    Yes, you are correct about the arx. It's a catch 22. If I unload it, they'll have to restart AutoCad to reload it. Since the majority of the RD4 users are here with me (we're spread out over a number of states) we decided to take the hit and be the ones to restart when we need the RD4. Most of our other sites will unload it when they open their first drawing in the morning, and never need it all day. We at this site will probably never see it unload. It was the lesser of two evils. Thanks so much for your help with this. You've been great!
     
    rewilson, Feb 12, 2004
    #17
  18. rewilson

    Jeff Mishler Guest

    You are quite welcome! I'm glad you got it figured out.

    they'll have to restart AutoCad to reload it. Since the majority of the
    RD4 users are here with me (we're spread out over a number of states) we
    decided to take the hit and be the ones to restart when we need the RD4.
    Most of our other sites will unload it when they open their first
    drawing in the morning, and never need it all day. We at this site will
    probably never see it unload. It was the lesser of two evils. Thanks so
    much for your help with this. You've been great!
     
    Jeff Mishler, Feb 12, 2004
    #18
  19. rewilson

    Devin Guest

    Makes sense!
     
    Devin, Feb 12, 2004
    #19
  20. rewilson

    Rudy Tovar Guest

    I believe this conversation went off on a tangent, but addressing the
    question, shouldn't this be a job for DBX, and instead close the drawings
    without having to open any.

    My 2 cents.
    --

    AUTODESK
    Authorized Developer
    www.Cadentity.com
    MASi


    attachment, and if it's nil execute an _iunload command.
    vla-get-documents to work the way I want. It always does the _iunload, even
    if it finds an image on one of the drawings. Any suggestions? BTW, this is
    for 2K4 w/rasterdesign 4. TIA.
     
    Rudy Tovar, Feb 13, 2004
    #20
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.