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

    Newbie's anxiety ---- simple question

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    5 Posts 2 Posters 216 Views 2 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.
    • B Offline
      bitbugbut
      last edited by

      Help!
      I wanna use "bed" in "Components Sampler", get its attribute"LenZ" , than write it into a txt file.
      How to write the codes?

      I watched a book named "Automatic Sketchup Creating 3D Models in Ruby",still do nothing 😞
      anyone help?Thanks

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

        Not all things have attributes.
        LenZ is one that a Dynamic Component has.
        I think that 'bed' isn't a DC ?
        If you want the size of something use something like bb=entity.bounds
        and then z=bb.depth
        x id width and y is height for a bounding box...
        If you explain what you wanted this for it might help.
        Writing a value to a text file is not much use ?
        The book you refer to has lots of help parts about all of this and more...
        Don't run before you can walk... πŸ˜‰

        TIG

        1 Reply Last reply Reply Quote 0
        • B Offline
          bitbugbut
          last edited by

          thanks a lot:)

          my real obstacle is : I create a component in design mode, its name : cup.
          when i write the code : bb=cup.bound , error coming:(

          bb=cup.bounds
          Error: #<NameError: undefined local variable or method `cup' for main:Object>
          (eval)

          Is my component"cup" not a entity?

          I hope you can give me the fully code segment about how to use defined componet"cup".thanks a lot!!!!! πŸ‘

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

            Ahhh...

            If you have definitely made a component called 'cup' [or even imported one into your SKP] then it should show up in the Component Browser > Model [small-house] icon...
            You need to make a reference to the definition thus
            model=Sketchup.active_model defs=model.definitions cup=defs["cup"]
            IF there is component called 'cup' you now have a 'reference' called 'cup' that points to it.
            If you type
            cup
            you should get a reference to it.
            Then
            bb=cup.bounds x=bb.depth
            etc ...
            If you have more questions [I'm sure you will!] post them in the Ruby forums - like the Developers' Section... πŸ€“

            TIG

            1 Reply Last reply Reply Quote 0
            • B Offline
              bitbugbut
              last edited by

              It really done:)

              thanks a lot .

              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