Getting "Text" z axis position from a ipt file

Getting "Text" z axis position from a ipt file

isocam
Collaborator Collaborator
359 Views
1 Reply
Message 1 of 2

Getting "Text" z axis position from a ipt file

isocam
Collaborator
Collaborator

Can anybody help???

 

I have the following function, in a VBA module, that extracts a text strings height, string,x,y,z and rotation angle.

 

All works fine, except for "z".

 

I need to know the origin of the text in the "Z" axis.

 

Can anybody tell me how this can be done?

 

Public Function WriteDxfTextEntities(Doc As PartDocument, sketch As PlanarSketch) As Boolean
    Dim sketchEnt As SketchEntity
     
    Dim ViewVector As UnitVector
    Dim sketchNormal As UnitVector
  
    Set ViewVector = GetViewVector(Doc)
    Set sketchNormal = sketch.PlanarEntityGeometry.Normal
   
    If sketchNormal.IsParallelTo(ViewVector) And sketchNormal.IsEqualTo(ViewVector) Then
       For Each TB In sketch.TextBoxes
           TextString = Trim(TB.Text)
 
           If TextString <> "" Then
              TextHeight = TB.Height * 10
                 
              DeltaX = TB.Origin.x * 10
        
              DeltaY = TB.Origin.y * 10
                           
              Rem DeltaZ = TB.Origin.z * 10     ****THIS IS THE PROBLEM LINE****
             
              DeltaW = TB.Rotation * Rad
             
              Msgbox DeltaZ
           End If
       Next
    End If
End Function

 

Many thanks in advance!!!

 

IsoCAM

0 Likes
360 Views
1 Reply
Reply (1)
Message 2 of 2

Mike.Wohletz
Collaborator
Collaborator

To get the text box Z location I think  that you are going to have to look at the plane that the sketch is drawn on to find this. When you have found that watch out since now you may not be looking for the z plane at all as it could be a distance from any of the origin planes. 

 

Sketch.PlanarEntityGeometry.RootPoint.Z should be in the neighborhood of what you are looking for.

 

Mike

 

0 Likes