I was not able to get the posted solution to work.
Doing a vlax-dump object on my block I do not see the scaled uniformly property either.
This is the result of a dump from a dynamic block that is uniformly scaled. However, sometimes i need to know whether the block i'm inserting is uniformly scaled before it is even defined on the drawing. Meaning i'll have to check that blocks dwg file from running lisp. Thats way beyond what i can do currently.
If anyone comes up with something else please post. 🙂
; IAcadBlockReference2: AutoCAD Block Reference Interface
; Property values:
; Application (RO) = #<VLA-OBJECT IAcadApplication 00000001406191d8>
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000002c5b40e0>
; EffectiveName (RO) = "BD_EQ"
; EntityTransparency = "ByLayer"
; Handle (RO) = "316"
; HasAttributes (RO) = -1
; HasExtensionDictionary (RO) = -1
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000031d0f4c8>
; InsertionPoint = (21.25 22.125 0.0)
; InsUnits (RO) = "Inches"
; InsUnitsFactor (RO) = 1.0
; IsDynamicBlock (RO) = -1
; Layer = "0"
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; Name = "*U4"
; Normal = (0.0 0.0 1.0)
; ObjectID (RO) = 42
; ObjectID32 (RO) = 42
; ObjectName (RO) = "AcDbBlockReference"
; OwnerID (RO) = 43
; OwnerID32 (RO) = 43
; PlotStyleName = "ByLayer"
; Rotation = 0.0
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000031d0f9a0>
; Visible = -1
; XEffectiveScaleFactor = 1.0
; XScaleFactor = 1.0
; YEffectiveScaleFactor = 1.0
; YScaleFactor = 1.0
; ZEffectiveScaleFactor = 1.0
; ZScaleFactor = 1.0
; Methods supported:
; ArrayPolar (3)
; ArrayRectangular (6)
; ConvertToAnonymousBlock ()
; ConvertToStaticBlock (1)
; Copy ()
; Delete ()
; Explode ()
; GetAttributes ()
; GetBoundingBox (2)
; GetConstantAttributes ()
; GetDynamicBlockProperties ()
; GetExtensionDictionary ()
; GetXData (3)
; Highlight (1)
; IntersectWith (2)
; Mirror (2)
; Mirror3D (3)
; Move (2)
; ResetBlock ()
; Rotate (2)
; Rotate3D (3)
; ScaleEntity (2)
; SetXData (2)
; TransformBy (1)
; Update ()
@jcourtne wrote:
... sometimes i need to know whether the block i'm inserting is uniformly scaled before it is even defined on the drawing. Meaning i'll have to check that blocks dwg file from running lisp. ....
If the Block is going to be inserted at uniform scales, and the only reason to check on whether it's defined for uniform scaling is to know whether to supply both X and Y scale factors in an Insert command, then you can eliminate the issue by using the Scale option in the command. It asks for a scale factor, and applies the same one to all axes, so you can supply it once, and it doesn't matter how many it would ask for if you weren't using that option:
(command "_.insert" "_scale" YourScale YourInsertionPoint ....
Kent is right. It is easy to avoid the issue when all scale factors are the same.
You were checking the block reference object (an insert), not a block object. This is one way to check if a block is uniformly scaled.
(vl-load-com) ;;DCB Returns true if the block is defined with ;;a uniform scale. (defun isuniform (blockname) (if (tblobjname "block" blockname) (= acUniform (vla-get-blockscaling (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object) ) ) blockname ) ) ) ) )
Thank you for pointing that out. That IS exactly why i wanted to know. I am now going back and revising how i'm inserting blocks in all my code to make sure that I will not contiue to have that problem. Here is a completed example of my workaround if any reader needs explicitly.
(vl-cmdf "-insert" (strcat path blockname) "S" 1 "R" 0 point)
Honestly, I don't know why i had never tried options other than just typing the values in for each question.
Thanks again.
You're welcome, I was going to suggest that 1 is the default, because 1 is always the default for X and Y scale factors [it doesn't remember the scales you used before], so you could just use "" for Enter instead of specifying 1. But in a quick test, it turns out that the Scale option doesn't default to 1 [nor remember the scale you used before], so you do need to provide a specific value.