VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ScaleEntity error

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
193 Views, 2 Replies

ScaleEntity error

I am useing a SelectionSet to get the Last entity that was create in the drawing. i.e. inserting a Block into drawing.

Then I am useing ScaleEntity on the entity in the Selection Set but keep getting this error message:
Run-time error '438':
Object doesn't support this property or method
What am I doing wrong?

I have a UserForm with a TextBox and a OK button and a Cancel button
---------------------------------
Private Sub cmdOK_Click()
' Create the selection set
Dim blkObj As AcadSelectionSet
Set blkObj = ThisDrawing.SelectionSets.Add("SSET2")
blkObj.Select acSelectionSetLast

MsgBox ("Selection set " & blkObj.Name & ", contains " & _
blkObj.Count & " items " & ", Scale Factor = " & TextBox1) _
, , "Selection Set info"

' Define the scale
Dim basePoint(0 To 2) As Double
Dim SCFT As Double
basePoint(0) = 4: basePoint(1) = 4.25: basePoint(2) = 0
SCFT = TextBox1.Text

'Scale the Object
blkObj.ScaleEntity basePoint, SCFT

' Clear SelectionSet from memory
blkObj.Clear
blkObj.Delete
Unload UserForm1
End Sub
--------------------------------
2 REPLIES 2
Message 2 of 3
joesu
in reply to: Anonymous

Keith,

Give this a whirl and see what ya think!

Joe
--
Public Sub ScaleLastObject()
Dim oEntity As AcadEntity
With ThisDrawing.ModelSpace
Set oEntity = .Item(.Count - 1)
End With

If TypeOf oEntity Is AcadBlockReference Then
Dim oBlockRef As AcadBlockReference
Set oBlockRef = oEntity
oBlockRef.ScaleEntity oBlockRef.InsertionPoint, 2.5
End If
End Sub
Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks, That worked GREAT.
Keith

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost