Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: tag definition or tagset

$
0
0

just to inform
my code works, it is not pretty but it works
I did this

'**********************************************
disegna_crocette:    ''**********************************************

        point2.x = point1.x + deltaest
        point2.y = point1.y + deltanord


            Select Case flag_tag
              Case False                                         ' no tag place cell no tag
                    CadInputQueue.SendKeyin "ac=" & "crocetta"
                    CadInputQueue.SendKeyin "place cell "
                    SetCExpressionValue "tcb->msToolSettings.placeCell.relative", 1, ""
                    CadInputQueue.SendDataPoint point2, 1

             Case True     ' place cell whit tag
                 scalacrocetta.x = fs   '
                 scalacrocetta.y = fs
                 scalacrocetta.z = 1
                 rotmatrix = Matrix3dFromAxisAndRotationAngle(2, 0)'
                 Set cella = Application.CreateCellElement2("crocetta_ril", point2, scalacrocetta, False, rotmatrix)
                 cella.LineWeight = Val(codice.wtcroc(codice.cod))
                 ActiveSettings.Level = ActiveDesignFile.Levels(codice.lvcroc(codice.cod))

                 cella.SetLevelRelative                    '[InputLevel]
                 cella.GraphicGroup = gg
                 ActiveModelReference.AddElement cella
                 cella.Rewrite'--------------------------'  re-writes the new tag values'--------------------------

                     ActiveModelReference.SelectElement cella
                     Set oHost = cella
                     If (oHost.HasAnyTags) Then
                      otags = oHost.GetTags()


                          tagValue = point1.nome
                          SetTagValue2 oHost, "0_nome", tagValue


                          tagValue = Format(point1.x, "0.00")
                          SetTagValue2 oHost, "1_est", tagValue


                          tagValue = Format(point1.y, "0.00")
                          SetTagValue2 oHost, "2_nord", tagValue'oTags.Redraw msdDrawingModeNormal   ' display the new value'oTags.Rewrite

                          tagValue = Round(point1.z, 2)
                          SetTagValue2 oHost, "3_quota", tagValue


                          tagValue = codice.cod
                          SetTagValue2 oHost, "4_codice", tagValue


                               If tipotag = 1 Then
                                   tagValue = point1.descr          ' tag descrizione  da file xls rilievo
                                   SetTagValue2 oHost, "5_descrizione", tagValue


                               Else
                                  tagValue = codice.descr(codice.cod) ' tag descrizione da file codici
                                  SetTagValue2 oHost, "5_descrizione", tagValue

                               End If

                          tagValue = point1.prof
                          SetTagValue2 oHost, "6_prof", tagValue


                          tagValue = point1.altezze         ' assign some value
                          SetTagValue2 oHost, "7_altezza", tagValue


                         tagValue = point1.dev         ' assign some value
                         SetTagValue2 oHost, "8_devia", tagValue

                      End If
                  End Select

Return

Private Sub SetTagValue2(oHost As Element, tagName As String, tagValue As Variant)

    On Error GoTo ErrorHandler

    Dim otags() As TagElement
    otags = oHost.GetTags

    Dim i As Long

    For i = LBound(otags) To UBound(otags)
        If (otags(i).TagDefinitionName = tagName) Then
            otags(i).Value = tagValue
            otags(i).Rewrite
            Exit Sub
        End If
    Next i

ErrorHandler:
End Sub

thank you
for the teachings, but I do not know if I'm a good student :)

have a nice weekend





Viewing all articles
Browse latest Browse all 7260

Trending Articles