Microstation V8i (08.11.09.833)
good morningI did not find an example of a filter where in addition to the type of cell element I can also add the cell nameyou can do it in vba or not
Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, Point As Point3d, Accepted As Boolean) ' Accepted defaults to False Accepted = False If Element.IsCellElement Then 'cell name check Accepted = True End If End Sub
thank you
Massimo Callegher said:I did not find an example of a filter where in addition to the type of cell element I can also check the cell name
You need to test the cell name in the _LocateFilter event …
_LocateFilter
accepted = False If oElement.IsCellElement Then accepted = 0 == StrComp (oElement.AsCellElement.Name, "Callegher", vbTextCompare) End If
However, that isn't very flexible, because the cell name is hard-wired into the test. You may prefer to give your ILocateCommandEvents class a data member to store the cell name …
ILocateCommandEvents
' Your ILocateCommandEvents class Implements ILocateCommandEvents Private m_strCellName As String
Write a property so you can set the cell name to be tested …
Public Property Let CellName (ByVal name As String) m_strCellName = name End Property
Modify your locate filter …
accepted = False If oElement.IsCellElement Then accepted = 0 == StrComp (oElement.AsCellElement.Name, m_strCellName, vbTextCompare) End If
Modify your call that creates the class …
Dim oCellLocator As YourLocatorClass Set oCellLocator = New YourLocatorClass oCellLocator.CellName = "Callegher" CommandState.StartLocate oCellLocator
Regards, Jon Summers LA Solutions
thank you so muchas soon as I have time, I try to insert your suggestionsps. how many things I still have to learn :)
I inserted the first suggestion, it is very simple for my knowledge of vba, and it works, but I would like to try the second one when I have time. thank you.
I put 0= instead of 0===
Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, Point As Point3d, Accepted As Boolean) ' Accepted defaults to False Accepted = False If Element.IsCellElement Then Accepted = 0 = StrComp(Element.AsCellElement.Name, "crocetta_ril", vbTextCompare) End If End Sub
Massimo Callegher said:I put 0= instead of 0===
¡Mea Culpa! I predominantly write C++ and C#, where the equality test is ==.
==