TBC Macros and Extensions

 View Only
Expand all | Collapse all

additional user attributes for drawing entities

  • 1.  additional user attributes for drawing entities

    Posted 12-10-2021 04:29
    How can you add additional attributes to entities like the 12d importer does for line strings.

    I found them actually in the Trimble.Vce.Core.Components.UserDefinedAttributes = 27 as protected dictionary.

    How can you add or change those.

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


  • 2.  RE: additional user attributes for drawing entities

    Posted 12-10-2021 04:52
    Hi Ronny,

    you can use the customattributes which work really great. I use them a lot for many of my macros as I store own attributes like object type, dimensions, material, floor, room, etc, etc.

    For example, to assign attributes to selected objects:

    for o in self.objs.SelectedMembers(self.currentProject):
              userAttributes = SnapInAttributeExtension.UserAttributes.Overloads[ISnapIn](o)
              if( userAttributes.ContainsKey("Position") == False):
                       userAttributes.Add("Position", strPosNum + "_" + strPosDesc + "_" + strPosType)
             else:
                      userAttributes ["Position"] = strPosNum + "_" + strPosDesc + "_" + strPosType
                     

    And then when I look for the objects in the project that contain my own attributes:

    for o in self.objsTree.SelectedMembers(self.currentProject):
              #Check if the object has Position and description
              userAttributes = SnapInAttributeExtension.UserAttributes.Overloads[ISnapIn](o)
              if(userAttributes.ContainsKey("Position")):
              strPosition = userAttributes ["Position"]

    I hope this helps.

    Regards,
    Fernando

    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 3.  RE: additional user attributes for drawing entities

    Posted 12-10-2021 18:49
    Edited by Ronny Schneider 12-10-2021 19:02
    Hi Fernando,
    thanks for that. That works, but they are only accessible by the macro. Would you know how to show them in the properties pane?

    It's actually working when I use SITECH's Key. So, how do I make the properties pane to show my custom key?


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



  • 4.  RE: additional user attributes for drawing entities

    Posted 12-11-2021 00:16
    Hi Ronny,

    so far I know, those userattributes are not shown on the properties pane. I created my own properties pane for showing custom atts.

    What you can do is using features of the FXL instead, so you can see all atributes on the  properties pane, also images and other attribute types.

    Not sure how 12d did that to show them on the properties pane.

    Regards,
    Fernando

    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 5.  RE: additional user attributes for drawing entities

    Posted 02-12-2023 16:52

    Hi Fernando, 

    Thanks for all your advice.

    I have a basic question, how would you access and assign/edit point attributes of the FXL? There are many classes associated with this but I still haven't figured out which one is the best approach.



    ------------------------------
    Weifan Zhou
    ------------------------------



  • 6.  RE: additional user attributes for drawing entities

    Posted 02-24-2023 10:20

    Hi Weifan,

    sorry for my late reply, but I´m not checking this forum in the last weeks due to high workload.

    Unfortunately I haven´t done anything with FXL attributes in TBC yet, only in Trimble Access accessing myself to the FXL attributes etc, but not in TBC, therefore I cannot tell you too much about the way to access them in TBC.

    I guess it´s using the Trimble.Vce.Data.FXL  

    Regards,

    Fernando



    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 7.  RE: additional user attributes for drawing entities

    Posted 03-08-2023 20:11

    Hi Fernando and Ronny,

    Sorry I didn't get back to you earlier, just came back from holiday. 

    With help from Ronny, "AssociatedRDFeatures" is the way to go for the feature code. 

    I have a new issue related to the topic. I have an IFC file, with each entity containing a long list of attributes. I tried to use "UserAttributes" but the count is zero, which means these attributes are not "UserAttributes" (unless i am doing something wrong here?)

    I also tried to use "UserDefinedAttributes.GetTypedValue" but I am not sure what parameter i should feed to it. 

    How would you extract the attributes out of an entity? 

    Thanks in advance

    Weifan



    ------------------------------
    Weifan Zhou
    ------------------------------



  • 8.  RE: additional user attributes for drawing entities

    Posted 03-12-2023 00:45
      |   view attached