sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Making components...

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 222 Views 3 Watching
    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.
    • T Offline
      tpoz
      last edited by

      Hello y'all,
      I'm having quite a hard time trying to figure out how to make components 😞
      I can retrieve components from the Component Samples folder and that seems to work, but what I really want to do is ask the user what the dimensions are (of a generic house or an image of a tree) and make the 'house' those dimensions.
      I think my problem is that I don't know how to define the edges/faces as a component. I don't really know what to replace

      componentdefinition= definition.load path
      

      with, or how to define my 'house' in the DefinitionList, or if this even makes sense.

      Any help would be greatly appreciated πŸ˜„
      Thanks,
      laura

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        
        house = model.definitions.add("MyHouse")
        house.entities.add_face(...)
        ...
        model.active_entities.add_instance(house)
        
        

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          Alternatively just make a group and add entities to it... then turn it into a component when you are done...

          
          ### you'll need to define stuff like entities, pt1/2 etc earlier on - it's skipped here for brevity
          group=entities.add_group()
          group.entities.add_line(pt1,pt2)
          ### add as much as you want...
          instance=group.to_component
          definition=instance.definition
          definition.name="My Definition's Name"
          instance.name="My Instance's Name"
          tr=Geom;;Transformation.new(ptxyz) ### ptxyz = new insertion point, as it'll be located at the ORIGIN by default
          instance.transform!(tr) ###to move or even rotate/scale it as needed
          ### etc
          ### to now add further stuff to definition use### definition.entities.add_...
          
          

          TIG

          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