Changing mtext Next word Formatting width

Changing mtext Next word Formatting width

GeeHaa
Collaborator Collaborator
575 Views
1 Reply
Message 1 of 2

Changing mtext Next word Formatting width

GeeHaa
Collaborator
Collaborator

Hi,

 

I'm writing a program to scale a drawing and when it encounters MTEXT it leaves the width factor at the previous value. I tried changing the width property but it does not change and it doesn't throw an error. Is there another property that handles this?

 

Thanks

 

 

                  For Each id In ids

                        Dim ent As Entity = TryCast(tr.GetObject(id, OpenMode.ForRead, False), Entity)
                        If ent Is Nothing Then Return
                        If Not ent.IsWriteEnabled Then ent.UpgradeOpen()

                        ent.TransformBy(Matrix3d.Scaling(convertVal, ptLL))

                        If TypeOf ent Is DatabaseServices.MText Then
                            Dim mt As MText = ent
                            mt.Width = mt.Width * convertVal
                        End If
                    Next

 

 

 

0 Likes
Accepted solutions (1)
576 Views
1 Reply
Reply (1)
Message 2 of 2

GeeHaa
Collaborator
Collaborator
Accepted solution

It seems in order for the width to be changed the columnType has to be set to NoColumns. If this is set the MTEXT Object Scales without having to change the width. I'm not sure if this is OK to do but it seems to work.

 

 

                    For Each id In ids
                        Dim ent As Entity = TryCast(tr.GetObject(id, OpenMode.ForRead, False), Entity)
                        If ent Is Nothing Then Return
                        If Not ent.IsWriteEnabled Then ent.UpgradeOpen()
                        ent.TransformBy(Matrix3d.Scaling(convertVal, ptLL))
                        If TypeOf ent Is DatabaseServices.MText Then
                            Dim mt As MText = ent
                            If mt.ColumnType <> ColumnType.NoColumns Then
                                If mt.ColumnCount = 1 Then
                                    mt.ColumnType = ColumnType.NoColumns
                                End If
                            End If
                        End If

                    Next

 

0 Likes