×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Linewidth change in V5 macro

Linewidth change in V5 macro

Linewidth change in V5 macro

(OP)
I tried to change the line thickness of titleBlock I drawed in VisualbasicScript Macro. I've used Visproperty function but it doesn't work.
If someone has done it, please send me an example that works.
ThanX

RE: Linewidth change in V5 macro

Hi
 It's not obvious how the VisProperties works with significant reading of the API guide & crashing about a bit. The following code is a VBA (as debugging is easier) sub to change the line thickness & type of a line object.

This runs fine as script on V5R9

The sub takes 3 parameters
  LineToChange as AnyObject (i.e. Line, circle, etc. Don't pass it anything the VisPropertySet methods cannot operate on as it will cause an error)

  Thickness as long (This takes an whole number value 1 to 67 relating to the thicknesses shown in the line properties dialog)

  LineType as long (This takes an whole number value 1 to 67 relating to the line types shown in the line properties dialog)

Hope this helps

Pete

'----------------------------------------------------------
'Change the line thickness & type of the object passed
'---------------------------------------------------------

Private Sub FormatLine(LineToChange As AnyObject, _
                       Thickness As Long, LineType As Long)
Dim SelectedStuff As Selection
Dim VisPropertiesOfSelection As VisPropertySet

'Connect to the selection object
  Set SelectedStuff = DrwDocument.Selection

'Ensure selection object is empty
  SelectedStuff.Clear

'Add the Item to the selection
  SelectedStuff.Add LineToChange

'Connect to the visual properties of the selection
 Set VisPropertiesOfSelection = SelectedStuff.VisProperties

'Change the visible width to the equired value
  VisPropertiesOfSelection.SetVisibleWidth Thickness, 0
  VisPropertiesOfSelection.SetRealLineType LineType, 0

'Clear the selection
  SelectedStuff.Clear

'Release the objects
  Set VisPropertiesOfSelection = Nothing
  Set SelectedStuff = Nothing
End Sub

RE: Linewidth change in V5 macro

sorry the long values for line width & type only go to 63 not 67.

pete

RE: Linewidth change in V5 macro

(OP)
Thank so much Peter. That works fine!!!
Coucou

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources