Jump to content

Import custom properties from other drawing


lastknownuser

Recommended Posts

Hi, need help with the following. How to import custom properties into my drawing from other drawing by selecting it? I tried with getfiled so I select other drawing (I get path name), but I don't know how to use "vla-get" functions to get  VLA-OBJECT variable of other drawing, so I could extract custom properties from it.

Link to comment
Share on other sites

I found some other programs so my LISP works like I want it, I get a list of custom properties by just clicking other drawing, but it only works with DWG files, could it also work with DXF?
Here is the code
 

(defun c:test_import ( / )
 (setq file (getfiled "Choose file" "" "dwg;dxf" 16))
 (setq ObjProp (CDP-List))
)
 
(defun open_dbx	(dwg / dbx)
  (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16)
    (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument"))
    (setq dbx (vlax-create-object
		(strcat	"ObjectDBX.AxDbDocument."
			(substr (getvar "ACADVER") 1 2)))))
 (vla-open dbx dwg)
 dbx
)

(defun CDP-List ( / docProps cnt key val return)
  ;returns list (key . value) of all custom drawing properties if any, or nil
  (setq docProps (vla-get-SummaryInfo (open_dbx file)))
  (repeat (setq cnt (vla-NumCustomInfo docProps))
    (vla-GetCustomByIndex docProps (setq cnt (1- cnt)) 'key 'val)
    (setq return (cons (cons key val) return))
  );repeat
  return
)

 

Link to comment
Share on other sites

A dxf file is a great big text file and that is bottom line, like others  no way am I spending hours coding to  find the match text keys and subsequent text values, just open a dxf with say notepad and have a look.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...