sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Created geometry on auto-move mode

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 2 Posters 1.8k 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.
    • L Offline
      lekonna
      last edited by

      wow that was a fast reply, thanks jim!

      Now i'll just have to dig out how the ComponentDefinition class works, as my geometry is at the moment only a group.

      [lekonna]

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        @lekonna said:

        wow that was a fast reply, thanks jim!

        Now i'll just have to dig out how the ComponentDefinition class works, as my geometry is at the moment only a group.

        Nah, just try it with the Group, it might work. But if not, you just create a new ComponentDefinition instead of a new Group and use the Defs entities. You shouldn't need to change but one line of code (maybe.) πŸ˜„

        Hi

        1 Reply Last reply Reply Quote 0
        • L Offline
          lekonna
          last edited by

          
          Error; #<TypeError; wrong argument type (expected Sketchup;;ComponentDefinition)>
          
          

          dang πŸ˜„ model.definitions seems to retrieve the list of component definitions in the model, but how do i go about creating one and assigning this group to it?

          [lekonna]

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            
            cdef = Sketchup.active_model.definitions.add("Component Def Name")
            
            

            Oh, you already have a Group. I forgot about Group.to_component !

            Hi

            1 Reply Last reply Reply Quote 0
            • L Offline
              lekonna
              last edited by

              alright. the documentation seems to be bit incomplete on that method.

              what i tried was:

              
                component = group.to_component
                status = model.place_component component
              
              

              and what i got was

              
              Error; #<TypeError; wrong argument type (expected Sketchup;;ComponentDefinition)>
              
              

              so it would seem that it doesn't return a componentdefinition

              [lekonna]

              1 Reply Last reply Reply Quote 0
              • L Offline
                lekonna
                last edited by

                haa gotit!

                the to_component returns a componentInstance which has the
                definition method returing just what i needed.

                Thanks a ton Jim!

                [lekonna]

                1 Reply Last reply Reply Quote 0
                • L Offline
                  lekonna
                  last edited by

                  hmm it seems that now i get double geometry, the one i place with the place_component and one created at 0,0,0 duh.

                  [lekonna]

                  1 Reply Last reply Reply Quote 0
                  • L Offline
                    lekonna
                    last edited by

                    Geez it seems i'm lost with this coding business, well it's been like 5 years, thats what managering stuff does to you i suppose.

                    Can you guys point a good way to get rid of the double geometry for me? If i just go ahead and upload the script here. Though i have to appologize for the code since the variables and texts are in finnish. Was bit too sure i could pull one simple script off by myselfs πŸ˜‰

                    So the problem being on how to get rid of the double geometry thats not folling the place_component.

                    Thanks in advance, should be no-brainer for you guys.

                    -Janne

                    301 Moved Permanently

                    favicon

                    (www.sketchucation.com)

                    [lekonna]

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by

                      You want to create a ComponentDefinition from the start. Try these changes:

                      
                      33; definition = Sketchup.active_model.definitions.add("New Def")
                      34; entities = definition.entities 
                      ...
                      113; (removed)
                      115; (removed)
                      
                      

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • L Offline
                        lekonna
                        last edited by

                        perfect, thanks Jim!

                        [lekonna]

                        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