Hi everybody again ,
Please , one question that may be anybody can helps me :
If I wan't to read the attributes ( Color , type , style , weight) of a element in VBA for Microstation V8i , I have seen that if you know the level , by this way , I can know the value of attributes of the element , with the code attached.
But , there is any way to find the attributes of a element ( that are defined Bylevel , value -1) without know the level_name or level_code ???
If I access to the attributes directly , element.color or element.style it returns me a value -1 ...
Any idea ????.
Thanks in advanced for your help !!!
The code attached :
For Each oLv In ActiveDesignFile.Levels If oLv.Name = Main.txtNivell.Text Then Main.txtColor.Text = oLv.ElementColor If oElement.IsCellElement Then Main.txtNivell.Text = oElement.AsCellElement.Name Main.txtCella.Text = oElement.AsCellElement.Name Else Main.txtCella.Text = "" End If Main.txtGruix.Text = oLv.ElementLineWeight Main.txtEstil.Text = oLv.ElementLineStyle.Name Main.txtClasse.Text = oElement.Class Main.txtTipus.Text = oElement.Type End If
Unknown said:Is there any way to find the attributes of a element ( that are defined Bylevel , value -1) without know the level_name or level_code?
An element's symbology is either explicit or ByLevel. If style, weight or colour is explicit then the information is available directly from the element.
If style, weight or colour is ByLevel then you must obtain that attribute from the element's level definition. It gets even more complicated when you consider that an element's appearance can be modified by view display settings...
Sub TraceSymbology (ByVal oElement As Element, ByVal oView As View) Dim msg As String If oElement.IsGraphical Then Dim oLevel As Level Set oLevel = oElement.Level msg = "Element ID " & DLongToString (oElement.ID) & " level '" & oLevel & "'" ShowMessage msg, msg, msdMessageCenterPriorityDebug, False Dim colour As Long colour = oElement.ApparentColor (oView) Dim oStyle As Style Set oStyle = oElement.ApparentStyle (oView) Dim weight As Long weight = oElement.ApparentWeight(oView) msg = "Colour " & CStr(colour) & " Weight " & CStr(weight) & " Style '" & oStyle.Name & "'" ShowMessage msg, msg, msdMessageCenterPriorityDebug, False Else msg = "Element ID " & DLongToString (oElement.ID) & " is not graphical and has no symbology" ShowMessage msg, msg, msdMessageCenterPriorityWarning, False End If End Sub
Regards, Jon Summers LA Solutions
Answer Verified By: Xavi García Maranges