• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Link Component Attributes to IFC Text fields

Scheduled Pinned Locked Moved Dynamic Components
sketchup
3 Posts 2 Posters 2.7k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    stefanocendron
    last edited by 7 Aug 2015, 15:00

    I'm looking for a way to link the Component Attributes Text (that changes depending on the component behaviour in the model) to the IFC Text that is possible to fill from the Component Options Window. Is there any trick / code / snippet to make this work? or is this something really complex to achieve?
    Thanks,
    Stefano


    here's the concept: IFC text automatically referring to the Component Attributes.

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 5 Nov 2015, 01:24

      The core code would look like this: Assume there is a single Component selected.

      
      
          model = Sketchup.active_model
          instance = model.selection[0]
         
          attributes = instance.definition.attribute_dictionary("dynamic_attributes")
          name = attributes["name"]
          desc = attributes["description"]
      
          path = ["IFC 2x3", "IfcFurnishingElement", "Name", "IfcLabel"]
          success = instance.definition.set_classification_value(path, name)
          path = ["IFC 2x3", "IfcFurnishingElement", "Description", "IfcText"]
          success = instance.definition.set_classification_value(path, desc)
       
      
      
      

      Hi

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 5 Nov 2015, 01:45

        It's unclear to me how the plugin would know to use "IfcFurnishingElement" as the type in the path. There does not appear to be any way to retrieving this type using a plugin. So I'm stumped.

        Hi

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement