Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
RTKarshick
Posts: 4
Registered: ‎02-13-2013
Message 1 of 2 (515 Views)

Change "Reference Name" of attached IMAGE xref .tiff

515 Views, 1 Replies
02-13-2013 07:40 AM

Greetings!

 

HEADACHE!

 

I am trying to write a LISP that does the following:

 

-Open drawing

-Saveas as NEW drawing based on certain criteria from DCL menu

-Deletes old drawing

-*THEN, if drawing contain attached IMAGE FILE (.tiff in my case)

-Rename image file and repath image file based on the new file name

 

I have gotten it to do all of this, except I can not figure out how to change the "reference name" of the attached image file (.tiff)

 

Is this read-only data? I can manualy change it under xref manager, so there should be a way to do it via code...

 

The closest I have gotten:

 

;;after renaming and repath image file...

 

(SETQ NAME2 (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)))

 

(setq item (vlax-ename->vla-object (entlast)));convert to vl object

 

  (setq check (vlax-property-available-p item "Name" T));check if the entity can be updated

  ;if it can
  (if check

   ;change value to match
   (vlax-put-property item 'Name NAME2))

 

 

'Name seems to be valid w/ xref'd blocks but not xref'd/attached image files..

 

Any help is greatly apprecated!

Thanks

Distinguished Mentor
Moshe-A
Posts: 739
Registered: ‎09-14-2003
Message 2 of 2 (502 Views)

Re: Change "Reference Name" of attached IMAGE xref .tiff

02-13-2013 01:58 PM in reply to: RTKarshick

Hi,

 

check this...it will return T if it successed or nil if not

 

 

(defun rename_raster_image (AcDbRasterImage NewImageName)
 (if (vlax-property-available-p AcDbRasterImage 'name t)
  (if (not
        (vl-catch-all-error-p
	 (vl-catch-all-apply
	   '(lambda ()
	      (vlax-put-property AcDbRasterImage 'Name NewImageName)
	    )
	 )
        )
      )
   t
  )
 )
)

 

Moshe

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community