Inserting a Drawing Without Knowing the Source Drawings Units

Inserting a Drawing Without Knowing the Source Drawings Units

mgorecki
Collaborator Collaborator
700 Views
2 Replies
Message 1 of 3

Inserting a Drawing Without Knowing the Source Drawings Units

mgorecki
Collaborator
Collaborator

Hello,

I'm writing a program that will insert a selected drawing into the new drawing.  The new drawing will always have insunits set to 4 (millimeters).  I have no idea what the drawings to be inserted scale could be.  Others will be using this program and I have no idea what drawings they'll select to insert.

Is there a way to always insert the drawings so they come in scaled in mm?

Thanks

0 Likes
701 Views
2 Replies
Replies (2)
Message 2 of 3

Moshe-A
Mentor
Mentor

@mgorecki  hi,

 

You can inspect the insunits of the drawing to be inserted with the following (openFileDBX) function.

 

moshe

 

 

 

(defun openFileDBX (dbxFile / dbxOpen)
    (if (setq dbxOpen
            (vlax-create-object
                (strcat    "ObjectDBX.AxDbDocument." (substr (getvar "ACADVER") 1 2) )
            )
        )
        (if (vl-catch-all-apply 'vla-open (list dbxOpen dbxFile))
            (not (vlax-release-object dbxOpen))
            dbxOpen
        )
        (princ "\nUnable to create object")
    )
)
0 Likes
Message 3 of 3

cadffm
Consultant
Consultant

@Moshe-A 

With odbx? Can you post a working sample please if you are not wrong, thx.

 

@mgorecki 

And dont forget insunitsdefsource insunitsdeftarget and aec units (if important for your case)

Sebastian