I already asked this question on Stackexchange as I could not log into this account yesterday, but I think it will have a better success rate here.
Namely, I'm having problems declaring the settings for a LineStyleParameter. I found a question here on Bentley where a similar code with C# worked though.
Can anyone tell me what's wrong with the below based on the error I get:
The purpose of the code is to set the linestyle, color, lineweight and then lastly two settings which are classified under Line Style Parametra and known as Scale and Corner Mode.
It's the line oLineElement.SetLineStyleParameters (oParams) that gives me the error 438: 'Object does not support this method or property'.
What's going wrong here?
Private Sub AdjustStyleToByLevel(lvlName As String) ' Set up level definitions Dim oLevel As Level Set oLevel = ActiveDesignFile.Levels(lvlName) ' Set up scan criteria Dim oScanCriteria As ElementScanCriteria Set oScanCriteria = New ElementScanCriteria oScanCriteria.ExcludeAllLevels oScanCriteria.IncludeLevel oLevel Dim oEnumerator As ElementEnumerator Set oEnumerator = ActiveModelReference.Scan(oScanCriteria) Dim oElement As Element Do While oEnumerator.MoveNext Set oElement = oEnumerator.Current If oElement.IsTraversableElement Then Dim oLineElement As LineElement Set oLineElement = oElement Set oLineElement.LineStyle = ByLevelLineStyle oLineElement.Color = ByLevelColor ' -1 oLineElement.LineWeight = ByLevelLineWeight ' -1 ' Define and set the Line Style settings Dim oParams As LineStyleParameters Set oParams = oElement.GetLineStyleParameters oParams.ScaleFactor = Share.ChartScale / 100 oParams.SetRunThroughCorners oLineElement.SetLineStyleParameters (oParams) oLineElement.Rewrite End If Loop End Sub
Hi Koit,
parenthesis are not used in VBA if a method is called without set =, so you have to remove them:
oLineElement.SetLineStyleParameters oParams
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point