Hi Friends !
I´m trying to create a function that return Z when there are a intersection in my DGNApplication . . . How can I give Z code of my Element2? This is my code...
Thanks!
Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, point As Point3d, Accepted As Boolean) Dim ScanEnumerator As ElementEnumerator Dim ScanCriteria As New ElementScanCriteria Dim Element2 As Element Dim t As Integer Dim points() As Point3d Set ScanEnumerator = ActiveModelReference.Scan(ScanCriteria) Do While ScanEnumerator.MoveNext Set Element2 = ScanEnumerator.Current If Element.IsIntersectableElement Then points = Element.AsIntersectableElement.GetIntersectionPoints(Element2, Matrix3dIdentity) End If
For t = 0 To UBound(points) If (UBound(points) = 0) Then Set oTextEle = CreateTextElement1(Nothing, points(t).Z, points(t), Matrix3dIdentity) ActiveModelReference.AddElement oTextEle End If Next LoopEnd Sub
Just a few small changes to your sub got it working:
The updated sub that worked for me is shown below.
Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, point As Point3d, Accepted As Boolean) Dim ScanEnumerator As ElementEnumerator Dim ScanCriteria As New ElementScanCriteria Dim Element2 As Element Dim t As Integer Dim points() As Point3d Dim oTextEle As TextElement Set ScanEnumerator = ActiveModelReference.Scan(ScanCriteria) Do While ScanEnumerator.MoveNext Set Element2 = ScanEnumerator.Current If Element.IsIntersectableElement Then points = Element.AsIntersectableElement.GetIntersectionPoints(Element2, Matrix3dIdentity) For t = 0 To UBound(points) If (UBound(points) = 0) Then Set oTextEle = CreateTextElement1(Nothing, points(t).Z, points(t), Matrix3dIdentity) ActiveModelReference.AddElement oTextEle End If Next End If LoopEnd Sub
Rod WingSenior Systems Analyst
My dear,
I get to give point Z from ElementEnumerator. Now I have to put the same rotation os my ElementEnumerator in my text. How can I do it?
This is my code! Thanks!
Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, Point As Point3d, Accepted As Boolean)
Dim counter As Integer
Dim t As Integer
Dim oEnumerator As ElementEnumerator
Dim oScanCriteria As New ElementScanCriteria
Dim myElement As Element
Dim points() As Point3d
Dim pointElemento() As Point3d
Dim oTextEle As TextElement
Dim coordZFormatada As String
Dim oMatrix As Matrix3d
Set elementoSelecionado = Element
oScanCriteria.ExcludeAllTypes
oScanCriteria.IncludeColor (175)
oScanCriteria.IncludeType msdElementTypeBsplineCurve
Set oEnumerator = ActiveModelReference.Scan(oScanCriteria)
Do While oEnumerator.MoveNext
counter = counter + 1
Set myElement = oEnumerator.Current
If myElement.IsIntersectableElement Then
points = myElement.AsIntersectableElement.GetIntersectionPoints(Element, Matrix3dIdentity)
End If
For t = 0 To UBound(points)
coordZFormatada = Replace(Format(CDbl(points(t).Z), "#,##"), "-", "")
Point.X = points(t).X
Point.Y = points(t).Y
Point.Z = points(t).Z
Set oTextEle = CreateTextElement1(Nothing, coordZFormatada, Point, oMatrix)
ActiveModelReference.AddElement oTextEle
Next
Loop
End Sub
Unknown said: Private Sub ILocateCommandEvents_LocateFilter(ByVal oElement As Element, Point As Point3d, Accepted As Boolean) Dim counter As Integer Dim t As Integer Dim oEnumerator As ElementEnumerator Dim oScanCriteria As New ElementScanCriteria
Private Sub ILocateCommandEvents_LocateFilter(ByVal oElement As Element, Point As Point3d, Accepted As Boolean)
I'm not sure what you are trying to do here, but ILocateCommandEvents_LocateFilter is — or should be — a simple Subroutine that tests oElement . If the element passes your filter, then set accepted to True. For example, if you are looking for TextElements, then this subroutine would look like this …
Private Sub ILocateCommandEvents_LocateFilter( _ ByVal oElement As Element, _ point As Point3d, _ accepted As Boolean) If msdElementTypeTex = oElement.Type Then accepted = True Else accepted = False EndIf End Sub
Regards, Jon Summers LA Solutions