TheSwamp
Code Red => VB(A) => Topic started by: Humbertogo on September 19, 2006, 02:30:11 PM
-
Is there a way to know in what units a block is drawing before insert the as block?
Thanks
-
What is your default? I'm assuming your wanting to know b/c its someone elses block?
-
i use autocad mechanical 2006
and use the AMLIBRARY to insert a block from the library
but we drawing in inches as mm.
for example
I work in a mm drawing and insert a block with the AMLIBRARY
even the insertunits is set to 4 Millimeters the block is insert 1:1
and not scale 25.4
if i use the insert command the block will scale automatic
i can Handel this with a event
Private Sub AcadDocument_ObjectAdded(ByVal Object As Object)
' On Error GoTo ERR_Clear
Dim objBlock As AcadBlockReference
If TypeOf Object Is AcadBlockReference Then
Set objBlock = Object
'
but not all blocks are drawing in inches some of then are drawing in mm
i need to know in witch units they are drawing to specific the scale
-
wow, that hurts my brain just thinking about it. I'll look and see if there are any ways to tell what it is drawn too.
-
Units may help you, I'm not sure, perhaps you can insert the blockref
then check the block.units then rescale the block if reqd.
Dim B As IAcadBlock3
Debug.Print B.units
-
unfortunately Debug.Print B.units is always 0
-
I should have listened to CmdrDuh-it hurts your brain.
So I've found no way, other than opening the dwg to find the units.
However.
Using a metric dwg and inserting a unitless inches dwg.
Using vba, it seemed like whatever combo of InsUnits , INSUNITSDEFSOURCE, INSUNITSDEFTARGET I set first,the blockref came in at the 1,1,1 scale I had set
Next trying insert with INSUNITS=0 DEFSOURCE=4 DEFTARGET=4
In the properties window the blockunit says inches unit factor 1 and x is 25.4
INSUNITS=0 DEFSOURCE=1 DEFTARGET=4 the same
INSUNITS=0 DEFSOURCE=4 DEFTARGET=1 bad for both inches x is 1 and mm x is 0.0394
As help says the INSUNITSDEFSOURCE and INSUNITSDEFTARGET only play when insunits =0
When using 4 for insunits I had good results on unitless drawings.
Interestingly the properties window now says inches unit factor 25.4 and x is 1
I don't know how to set a drawing from unitless.
-
I'll have another go at this.
The units property reflects the insunits value of the drawing.
A standard inches dwg will have
INSUNITS=1 DEFSOURCE=1 DEFTARGET=1
A standard mm dwg will have
INSUNITS=4 DEFSOURCE=1 DEFTARGET=1 (Cad blunder, 4,4,4 is better)
To create a truely unitless drawing you need
INSUNITS=0 DEFSOURCE=0 DEFTARGET=0
as a mm dwg with the INSUNITS set to 0 will still have
DEFSOURCE=1 DEFTARGET=1 and so will insert like an inch drawing.
So Humbertogo you may need to change all the unitless dwgs to their correct setting.
Unitless blocks are handy for ???? unit circles of 1 unit, confusing people, making refernce blocks.