TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: zoltan on February 28, 2007, 10:55:03 AM

Title: Inserting a Raster that is already loaded
Post by: zoltan on February 28, 2007, 10:55:03 AM
I'm having trouble inserting multiple instances of a raster without creating multiple references in the External References manager.

In AutoCAD 2007, I can attach an image with VLA-AddRaster and everytime I attach the same image path, it creates a new attachment in the references manager  The usually have the name OAImg2127129200 with the string of number different every time.   I can rename the reference with VLA-Put-Name, and it shows up in the references manager.  What I can't seem to do is insert another reference of the same name, so that they can be unloaded or detached together instead of as separate references.

Here's a little test function:
Code: [Select]
(Defun c:TestImage ( / sImagePath pntInsert oImage )
 (VL-Load-COM )
 (SetQ sImagePath (GetFileD "Select Image" "" "BMP" 0) )

 (While (SetQ pntInsert (GetPoint "\nPick Point"))
  (SetQ oImage
        (VLA-AddRaster
         (VLA-Get-Modelspace (VLA-Get-ActiveDocument (VLAX-Get-Acad-Object)) )
         sImagePath
         (VLAX-3D-Point pntInsert )
         1.0
         0.0
        )
  )
;;;  (VLA-Put-Name oImage "test" ) ;this won't work!
;;;  (VLA-Update oImage )
 )

 (TerPri )
 (Prin1 )
)
Title: Re: Inserting a Raster that is already loaded
Post by: David Hall on February 28, 2007, 04:13:33 PM
what about copying the image file?  then it should be 1 reference to file, but multiple references in the dwg file
Title: Re: Inserting a Raster that is already loaded
Post by: zoltan on February 28, 2007, 07:46:47 PM
Yea... copying it works, but my images will be nested in blocks so the next block I create I would have to dig a copy out of another block definition.  It's possible, just a real pain!