Author Topic: Image file name, soft path  (Read 3116 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Image file name, soft path
« on: August 22, 2006, 03:36:27 PM »
A recent topic here has got me thinking about a problem that I never could find an answer to.  How can one get the real path of an image?  You can get a path from the image object itself (vla-get-ImageFile ImObj) or from the image definition (forget how to get it right now), but they will both point you to the path that is saved.  Say you change the path in the dialog box, but don't hit the save path button.  The path is changed, and the new image is shown, but it will still show the old path when looking in those two areas mentioned above, but will show the new path in the image dialog box.  I have looked high and low for the new soft path, but can't find it anywhere.

Any/all help appreciated.  Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Image file name, soft path
« Reply #1 on: August 23, 2006, 07:12:21 AM »
I just woke up, so the neurons are kind of loopy, iow take this quick one off for what it's worth --

Print out the image current paths --

Code: [Select]
(defun c:Foo ( / acad_image_dict )       
       
    (vl-catch-all-apply
       '(lambda ( )
            (setq acad_image_dict
                (vla-item
                    (vla-get-dictionaries
                        (vla-get-activedocument
                            (vlax-get-acad-object)
                        )
                    )
                    "ACAD_IMAGE_DICT"
                )   
            )
        )
    )   

    (if acad_image_dict
        (vlax-for entry acad_image_dict
            (print
                (cdr
                    (assoc 1
                        (entget
                            (vlax-vla-object->ename entry)
                        )
                    )
                )
            )   
        )
    )
   
    (princ)
   
)

Also, note, starting with the acad_image_dict as dxf data  --

(
    (-1 . <Entity name: 7ef81ee8>)
    (0 . "DICTIONARY")
    (5 . "95")
    (102 . "{ACAD_REACTORS")
    (330 . <Entity name: 7ef81c60>)
    (102 . "}")
    (330 . <Entity name: 7ef81c60>)
    (100 . "AcDbDictionary")
    (280 . 0)
    (281 . 1)
    (3 . "pic15") <<--------------- name
    (350 . <Entity name: 7ef81ef8>) -->-->--+
)                                           |   
                                            |
(                                           |
    (-1 . <Entity name: 7ef81ef8>) <--<--<--+
    (0 . "IMAGEDEF")
    (5 . "97")
    (102 . "{ACAD_REACTORS")
    (330 . <Entity name: 7ef81ee8>)
    (330 . <Entity name: 7ef81f00>)
    (102 . "}")
    (330 . <Entity name: 7ef81ee8>)
    (100 . "AcDbRasterImageDef")
    (90 . 0)
    (1 . "U:\\12.jpg") <<---------- path
    (10 560.0 750.0 0.0)
    (11 0.00178571 0.00178571 0.0)
    (280 . 1)
    (281 . 0)
)


Some stuff to play with anyway; cheers.
« Last Edit: August 23, 2006, 07:16:18 AM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Joe Burke

  • Guest
Re: Image file name, soft path
« Reply #2 on: August 23, 2006, 07:28:36 AM »
Hi Tim,

I tried what you suggested. Manually repath an image without using the save path button.
Yes, a new image replaces the original, but the path property remains unchanged. Save the
file, close and reopen. The original image reappears.

I think this is similar to the fact you can attach an xref which resides in some folder
other than the folder where the active file resides without saving the path. But after
save, close and reopen the xref can't be found.

So it makes sense, to me anyway, that the path property doesn't change unless you use
the save path button.

If you still want to get the temporary path, I don't know how you'd do that.

Joe Burke

  • Guest
Re: Image file name, soft path
« Reply #3 on: August 23, 2006, 07:49:44 AM »
Michael,

That returns the original path same as:

(vlax-get (vlax-ename->vla-object (car (entsel "Select image: "))) 'ImageFile)

I believe Tim is looking for a temporary path, "but don't hit the save path button."

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Image file name, soft path
« Reply #4 on: August 23, 2006, 07:58:28 AM »
That was a temp path. It originally was mapped to pic15 but then I repathed it to Pic12 without saving the document.

More scintillating info, but I don't have time to bash any related code --



Sorry for the brevity, time to head off to work.

Enjoy.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Joe Burke

  • Guest
Re: Image file name, soft path
« Reply #5 on: August 23, 2006, 08:06:22 AM »
Michael,

We must be doing something different. When I ran Foo it returned the original path rather than the temporary path.

I'm not doubting what you said...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Image file name, soft path
« Reply #6 on: August 23, 2006, 11:19:22 AM »
'Foo' isn't working for me either Michael.  It returns the saved path, not the path where the file is found, if found.  I will continue to look around also.  Thanks for trying.

Joe,

  You are correct in your first post.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Image file name, soft path
« Reply #7 on: August 23, 2006, 02:33:17 PM »
'Foo' isn't working for me either Michael.

I'm not surprised, neither was my brain when I posted -- sorry for the distractions folks. Wish I could play, looks a fun challenge.

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Image file name, soft path
« Reply #8 on: August 23, 2006, 02:37:18 PM »
'Foo' isn't working for me either Michael.

I'm not surprised, neither was my brain when I posted -- sorry for the distractions folks. Wish I could play, looks a fun challenge.


No problem Michael, if it only got others talking about it, it was a good thing.  Play when you can, as I think this one is going to take a while to figure out.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Image file name, soft path
« Reply #9 on: August 27, 2006, 05:34:41 AM »
How I can receive the list with all pixels (*.jpg *.bmp), used lisp only?

Thanks.
« Last Edit: August 27, 2006, 05:35:47 AM by ElpanovEvgeniy »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Image file name, soft path
« Reply #10 on: August 28, 2006, 11:17:58 AM »
This will get a list of all images inserted into the drawing (in any space) where Doc is a valid document object
Code: [Select]
(vlax-for Lo (vla-get-Layouts Doc)
 (vlax-for Obj (vla-get-Block Lo)
  (if
   (and
    (= (vla-get-ObjectName Obj) "AcDbRasterImage")
;    (findfile (vla-get-ImageFile Obj))
    (not (vl-position (vla-get-Name Obj) ImList))
   )
   (setq ImList (cons (vla-get-Name Obj) ImList))
  )
 )
)
And this will list all the images in the image dictionary.
Code: [Select]
(setq cnt 0)
(if
 (not
  (vl-catch-all-error-p
   (setq ImDict
    (vl-catch-all-apply
     '(lambda ()
      (vla-Item
       (vla-get-Dictionaries
        (vla-get-ActiveDocument
         (vlax-get-Acad-Object)
        )
       )
       "ACAD_IMAGE_DICT"
      )
     )
    )
   )
  )
 )
 (repeat (vla-get-Count ImDict)
  (setq ImList2 (cons (vla-GetName ImDict (vla-Item ImDict cnt)) ImList2))
 )
)

Is this what you were after?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: Image file name, soft path
« Reply #11 on: September 02, 2006, 12:50:23 AM »
:)
 I also wonder can Lisp read each pixel of the bmp files.

Because I fail to find the Lisp method, I have to find a bmp2txt dephi software to do it.
The following pic is draw in autocad by convert bmp2txt and read txt to draw pic.
The next step I wonder is how to find out the each same color region and maybe the outline profile of each region, then maybe it is one way to realize the bitmap to vector conversion:) , like vpdemo.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

chlh_jd

  • Guest
Re: Image file name, soft path
« Reply #12 on: September 28, 2012, 08:13:59 AM »
:)
The next step I wonder is how to find out the each same color region and maybe the outline profile of each region, then maybe it is one way to realize the bitmap to vector conversion:) , like vpdemo.
ElpanovEvgeniy has nice reply . See here
http://www.theswamp.org/index.php?topic=42846.msg480981#msg480981