Setting the width factor of a acadtext object with VBA
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Setting the width factor of a acadtext object with VBA

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
peterpeter



Joined: 29 Jul 2005
Posts: 7

Posted: Sat Jul 22, 2006 1:48 pm    Post subject: Setting the width factor of a acadtext object with VBA Reply with quote

Hallo AutoCad Goeroes,

Does anyone know how to set the width factor of a text object via VBA.
When I look to the property's of the text object I can't find a property to control the width.

Thank you

Peter Van der velden

Back to top
View user's profile Send private message Send e-mail
Fatty



Joined: 08 Jun 2006
Posts: 8
Location: Sankt-Petersburg, Russia

Posted: Sat Jul 22, 2006 8:31 pm    Post subject: Re: Setting the width factor of a acadtext object with VBA Reply with quote

peterpeter wrote:
Hallo AutoCad Goeroes,

Does anyone know how to set the width factor of a text object via VBA.
When I look to the property's of the text object I can't find a property to control the width.

Thank you

Peter Van der velden

Hi Peter,
see how this will work for you:

Code:
Sub Ch_ScaleFactorExample()
    Dim pickObj As AcadEntity
    Dim varPt As Variant
    Dim sclFac As Double

    On Error GoTo error_trapp
    ThisDrawing.Utility.GetEntity pickObj, varPt, "Select text:"
    If TypeOf pickObj Is AcadText Then
    sclFac = InputBox("Enter new scale factor for the text", _
    "Change Scale Factor", 1) ' by default 1
    pickObj.ScaleFactor = sclFac
    pickObj.Update
    Else
    MsgBox "This is not a text object"
    End If
   
error_trapp:
    MsgBox Err.Number & Err.Description
 
End Sub   


~'J'~
Back to top
View user's profile Send private message
peterpeter



Joined: 29 Jul 2005
Posts: 7

Posted: Sun Jul 23, 2006 2:02 pm    Post subject: Re: Setting the width factor of a acadtext object with VBA Reply with quote

Fatty wrote:
peterpeter wrote:
Hallo AutoCad Goeroes,

Does anyone know how to set the width factor of a text object via VBA.
When I look to the property's of the text object I can't find a property to control the width.

Thank you

Peter Van der velden

Hi Peter,
see how this will work for you:

Code:
Sub Ch_ScaleFactorExample()
    Dim pickObj As AcadEntity
    Dim varPt As Variant
    Dim sclFac As Double

    On Error GoTo error_trapp
    ThisDrawing.Utility.GetEntity pickObj, varPt, "Select text:"
    If TypeOf pickObj Is AcadText Then
    sclFac = InputBox("Enter new scale factor for the text", _
    "Change Scale Factor", 1) ' by default 1
    pickObj.ScaleFactor = sclFac
    pickObj.Update
    Else
    MsgBox "This is not a text object"
    End If
   
error_trapp:
    MsgBox Err.Number & Err.Description
 
End Sub   


~'J'~


Hello Fatty,

I have tried your code and it works perfect.

I thought that the .scalefactor property would scale the object in the X and Y dimentions.

Thank You very much for the help and the quick reply

Peter

Back to top
View user's profile Send private message Send e-mail
Fatty



Joined: 08 Jun 2006
Posts: 8
Location: Sankt-Petersburg, Russia

Posted: Sun Jul 23, 2006 7:58 pm    Post subject: Reply with quote

Hi Peter
Glad to help
Cheers
Smile

~'J'~
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB