Accessing RasterImages in a drawing

Discussion in 'AutoCAD' started by Michel, Jun 8, 2004.

  1. Michel

    Michel Guest

    Hi,
    Thanks to my superiors our office now stores files in a different directory-structure. All project related files, including dwgs, have moved to a new location. And I'm supposed to supervise the transfer for AutoCAD files. So far so good, I wrote a little app to re-attach xrefs (convert paths to relative paths).

    But... Our architects/designers use a lot of rasterimages in their drawings. I've looked at the AutoCAD VBA-Objectmodel, but there no such thing as a RasterImages collection. I tried to access them via a selectionset but a selectionset only returns selectable entities. And when am image is not loaded....

    Does anyone have a sollution? Or am I condemned to open and check 10000+ drawings? See also code below.

    thanks in advance.
    Michel

    Code:
    Dim objIma As AcadRasterImage
    Dim SS As AcadSelectionSet
    Dim gpCode(0) As Integer
    Dim Filter(0) As Variant
    Dim i As Integer
    Dim objItem As ListItem
    
    On Error Resume Next
    Set SS = ThisDrawing.SelectionSets.Add("images")
    If Err.Number <> 0 Then
    ThisDrawing.SelectionSets("images").Delete
    Set SS = ThisDrawing.SelectionSets.Add("images")
    End If
    On Error GoTo 0
    
    gpCode(0) = 0
    Filter(0) = "image"
    
    SS.Select acSelectionSetAll, , , gpCode, Filter
    
    If SS.Count > 0 Then
    For i = 0 To SS.Count - 1
    Set objIma = SS(i)
    Set objItem = formImages.lstvwImages.ListItems.Add(, , objIma.Name)
    objItem.SubItems(1) = objIma.ImageFile
    Next i
    End If
    
    SS.Delete
     
    Michel, Jun 8, 2004
    #1
  2. Michel

    wivory Guest

    Hi Michele,

    Off topic, would you mind telling what method you used to put your code nicely in a table like that (for us web readers)?

    And newsreader people: Does it look nice to you or is it full of formatting codes?

    Thanks

    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Jun 9, 2004
    #2
  3. Michel

    Jeff Mishler Guest

    Hi Wayne,
    I'll answer since I can give feedback on both parts and I was just looking
    at Michel's post when yours came up.

    The code is wrapped in 'code' tags. Prior to the actual code, start with a
    bracket "[" then the word "code" then a closing bracket "]"....then place
    your code and finish it with a bracket "[" slash "/" "code" bracket "]".

    i obviously can't show you exactly how it looks but that should get you
    going. As for looks in the newsreader, it looks great in OE6! The only thing
    is we can see the code tags......no big deal.

    Jeff

    nicely in a table like that (for us web readers)?
     
    Jeff Mishler, Jun 9, 2004
    #3
  4. Michel

    Jeff Mishler Guest

    Michel,
    I have looked into this and can't find a way in ActiveX. However, using the
    DXF codes and a little lisp it is possible. The imagedefinitions are stored
    in the "Acad_Image_Dict". In VBA you can get the names of the images, as
    well as the handles, but that's about it it. Using the lisp functions
    (entget) & (handent) will return the path in assoc list 1.

    If you need more info, just ask.

    BTW, the VLAX class that Frank O. has posted a few times in the last week
    should allow you to do this from VBA.

    Jeff

    RasterImages collection. I tried to access them via a
     
    Jeff Mishler, Jun 9, 2004
    #4
  5. Michel

    wivory Guest

    Thanks Jeff. I suspected it might be something like that and went back to Autodesk's Help on the web interface to see if they'd updated it, but it still only talks about using the "pre" format code. How'd you know about the "code" keyword?
    Code:
    If ThisWorks Then
    MsgBox "Mission Accomplished, vbExclamation
    End If
    
    Regards

    Wayne
     
    wivory, Jun 9, 2004
    #5
  6. It's clean in a real newsreader - sorry can't stand OE :) I use 40tude and
    I don't even see the code tags. If you can access the news feed, try 40tude
    - its free nd better than OE by leaps and bounds [I won't even dicuss the
    web side] ;-)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jun 9, 2004
    #6
  7. Michel

    Michel Guest

    I've never looked into LISP and/or VLAX before. But I'll look into that. Thanks Jeff.

    Michel
     
    Michel, Jun 9, 2004
    #7
  8. Michel

    Michel Guest

    The "code" tag is something I use on a another (Dutch) discussion group. You can select different kinds of tags there. I tried the code-tag once in these groups and it worked...
     
    Michel, Jun 9, 2004
    #8
  9. Michel

    Tom Craft Guest

    Michel,
    Wow, don't see that many postings get kidnapped like yours. Glad to see someone finally got around to your question.
    I would think a new message subject was in order.

    Tom
     
    Tom Craft, Jun 14, 2004
    #9
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.