Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linewidth change in V5 macro

Status
Not open for further replies.

coucou

Automotive
Mar 15, 2003
2
FR
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
 
Replies continue below

Recommended for you

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
 
sorry the long values for line width & type only go to 63 not 67.

pete
 
Thank so much Peter. That works fine!!!
Coucou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top