TBC Macros and Extensions

 View Only
Expand all | Collapse all

Simple question about the lableling

  • 1.  Simple question about the lableling

    Posted 04-02-2023 09:20

    Happy Sunday Trimble folks,

    A quick question on PointLableEntity Class,

    Could somebody help me on initializing the instance of this Class?  When I follow below order it doesn't label anything. While debugging an instance with labels, I noticed a {get;} property in this class called ObjectAnchorPosition was initialized for those existing label objects so I assume the order that I'm following is incorrect. Any advise?

                firstLable= wv.Add(clr.GetClrType(PointLabelEntity))
                #Assuming 'myPoint3D' object is given
                firstLable.Point0=myPoint3D
                firstLable.PointLabelStyleSerial=16742
                #Assmuing 'myStyle' and its Serial Number are known
                firstLable.StyleName='mystyle'
                firstLable.TextStyleSerial=16706
                firstLable.TextString='SomeText'


    Thanks,







    ------------------------------
    Morteza Kiani
    ------------------------------


  • 2.  RE: Simple question about the lableling

    Posted 04-02-2023 14:03

    Haven't tested it but I'd assume that you need to set the PointSerial, since a Label is always attached to point. The Label-object will then probably inherit the points location.




    ------------------------------
    Ronny Schneider
    ------------------------------



  • 3.  RE: Simple question about the lableling

    Posted 04-02-2023 22:49

    Thanks for the quick response!

    I added a point per label as below:

    newpoint=self.pointCollection.Add(clr.GetClrType(Point))
    newpoint.PointID="something"
    newpoint.AddCoordinate(NEECoordinate(x, y, z))

    In that case I have to create a lot of points to role as anchors for the labels. What if I just to want to label a coordinate! Is there anyway of doing that without defining a point?

    Thanks,



    ------------------------------
    Morteza Kiani
    ------------------------------



  • 4.  RE: Simple question about the lableling

    Posted 04-03-2023 00:04

    That won't be possible, that's not how the point labels work. From the F1-Help

    You'll always need a worldview object that is connected to that label.

    You don't necessarily have to use named points, a simple Foreigncad.Point should suffice.

    from Trimble.Vce.ForeignCad import Point as CadPoint
    
                    cadPoint = wv.Add(clr.GetClrType(CadPoint))
                    cadPoint.Point0 = p
                    cadPoint.Layer = self.layerpicker.SelectedSerialNumber
    


    ------------------------------
    Ronny Schneider
    ------------------------------



  • 5.  RE: Simple question about the lableling

    Posted 04-03-2023 06:57

    Understood! Thanks Ronny!



    ------------------------------
    Morteza Kiani
    ------------------------------



  • 6.  RE: Simple question about the lableling

    Posted 04-04-2023 07:59

    Yes, the PointLabel object needs a point to label but you can just use MText with smart text to label a coordinate. Use either the text insertion location or a leader line to extract the coordinate.



    ------------------------------
    Gary Lantaff
    ------------------------------



  • 7.  RE: Simple question about the lableling

    Posted 04-04-2023 20:56

    I believe I should go back and rename the topic since I posed the question on utilizing the PointLableEntity class and to @Ronny Schneider 's  point, there's no way to use this class without instantiating a point feature.

    Now, looking at MText, I believe it has plus that you don't have to create a point as an anchor. I haven't thought about that! Thanks!



    ------------------------------
    Morteza Kiani
    ------------------------------



  • 8.  RE: Simple question about the lableling
    Best Answer

    Posted 04-04-2023 22:44

    Since you asked specifically for labels I didn't mention the MTexts. But I use them exclusively in my macros, I never use labels. Although I actually have asbuilt stakeout points for all of it.
    Sometimes the label would have to be dependent on 4 different things and their differences, i.e. Asbuilt point + find the next closest design line + blinding design + blinding asbuilt.



    Or the combinations between bearing pad points, relative to an arbitrary 3D plane, there is no way to do this with labels.



    ------------------------------
    Ronny Schneider
    ------------------------------



  • 9.  RE: Simple question about the lableling

    Posted 04-05-2023 06:26

    Thank you Gents! and Thanks to you Ronny for a complete clarification on this! I hope others read the whole Thread since the title is a bit misleading and it should be more like " Point Lables VS MText " and you and @Gary Lantaff  were explaining the differences here.

    My main confusion was that I didn't have an estimate about number of the labels at first and I just needed a rough labeling. Moving forward, I learned that I might have lots of labels needed and adding points for each label was an extra step.

    Thanks,




    ------------------------------
    Morteza Kiani
    ------------------------------