scale block with atributes from VBA

The VBA forum deals with IntelliCAD 2000 VBA (Visual Basic for Applications) issues.

Moderator: CMS Inc

Post Reply
georges
Contributor
Posts: 12
Joined: Mon Mar 03, 2003 12:01 am

scale block with atributes from VBA

Post by georges » Sat Jun 26, 2004 3:54 pm

I use VBA to change the scale of blocks with 3 attributes (Tree symbol with Numbers, Species and Size)

'--------------------------------------------------------------
'Public Function ChangeCadBlkScale
'--------------------------------------------------------------
Public Function ChangeCadBlkScale(oEnt As IntelliCAD.Entity, dScale As Double) As Boolean
Dim oBlk As IntelliCAD.BlockInsert
Set oBlk = oEnt
oBlk.XScaleFactor = dScale
oBlk.YScaleFactor = dScale
oBlk.Update
Set oBlk = Nothing
End Function

In that function I use dScale to enlarge or shrink the block.

The entity to change (oEnt) is defined by the HandleToObject-method, where the handle is stored in an MS Access database.

'--------------------------------------------------------------
'Public Function SelectCadEntByHandle
'--------------------------------------------------------------
Public Function SelectCadEntByHandle(sHandle As String, oEnt As IntelliCAD.Entity) As Boolean
On Error Resume Next
Dim myDB As DAO.Database
Dim rstFromDwg As DAO.Recordset
Set myDB = Application.CurrentDb
sHandle = rstFromDwg!Handle
Set ThisDrawing = CadApp.ActiveDocument 'just to make sure ThisDrawing actually points to the current active drawing
Set oEnt = ThisDrawing.HandleToObject(sHandle)

On Error GoTo 0
If oEnt Is Nothing Then
SelectCadEntByHandle = False
Else
SelectCadEntByHandle = True
End If
End Function

This works fine and in the drawing only the tree-symbol is changed. The text size of the attributes stays the same. Only when I explode the blocks, or when I need to change the attributes (in Autocad), the attributes-text is also shrinked or enlarged.
Is there another way in VBA (than oBlk.X ScaleFactor = dScale and oBlk.YScaleFactor = dScale) to scale the symbol part of the block without affecting the attributes-scale?

I hope you understand my problem / question.

Regards Georges
Post Reply