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

    [Plugin] Edges/Construction Lines Converter V1.3

    Scheduled Pinned Locked Moved Plugins
    25 Posts 13 Posters 26.6k Views 13 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.
    • Dave RD Offline
      Dave R
      last edited by

      @clayton49 said:

      Hi All,

      Can anyone confirm if this PLUG-IN works with SU Pro-2014.

      Over & out,
      Clayton.

      What happens when you try it?

      Etaoin Shrdlu

      %

      (THERE'S NO PLACE LIKE)

      G28 X0.0 Y0.0 Z0.0

      M30

      %

      1 Reply Last reply Reply Quote 0
      • greenskpG Offline
        greenskp
        last edited by

        Thank you!
        Works great! SketchUp 2015!

        1 Reply Last reply Reply Quote 0
        • F Offline
          function
          last edited by

          bug on console load 2016

          C;/Users/user01/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/xLinem.rb;39; warning; class variable access from toplevel
          C;/Users/user01/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/xLinem.rb;40; warning; class variable access from toplevel
          
          1 Reply Last reply Reply Quote 0
          • Dave RD Offline
            Dave R
            last edited by

            @function said:

            bug on console load 2016

            C;/Users/user01/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/xLinem.rb;39; warning; class variable access from toplevel
            > C;/Users/user01/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/xLinem.rb;40; warning; class variable access from toplevel
            

            How did you install it? I just installed it in SU2016 using the Extension Store and it works just fine.

            Etaoin Shrdlu

            %

            (THERE'S NO PLACE LIKE)

            G28 X0.0 Y0.0 Z0.0

            M30

            %

            1 Reply Last reply Reply Quote 0
            • F Offline
              function
              last edited by

              strange, I always use thomthom's drag and drop - is it possible something else could cause an error like that?

              1 Reply Last reply Reply Quote 0
              • Dave RD Offline
                Dave R
                last edited by

                What do you mean you use ThomThom's drag and drop?

                I expect you've got the thing installed incorrectly or it would work.

                Etaoin Shrdlu

                %

                (THERE'S NO PLACE LIKE)

                G28 X0.0 Y0.0 Z0.0

                M30

                %

                1 Reply Last reply Reply Quote 0
                • F Offline
                  function
                  last edited by

                  thomthom's drop zone installer. still gives me error, also using eneroth's console opener on start, not sure if that has something to do with it

                  1 Reply Last reply Reply Quote 0
                  • Dave RD Offline
                    Dave R
                    last edited by

                    If you've got a bad installation of it, installing it again won't clean it up. At this point you should go to the Plugins folder and remove all traces of this plugin. Then either download the RBZ file and installed it with Install Extension in Preferences>Extensions or navigate to it in the Sketchucation Extension Store and install it with the Install button. Both of those options are sure to install it correctly.

                    Etaoin Shrdlu

                    %

                    (THERE'S NO PLACE LIKE)

                    G28 X0.0 Y0.0 Z0.0

                    M30

                    %

                    1 Reply Last reply Reply Quote 0
                    • SketcheldarS Offline
                      Sketcheldar
                      last edited by

                      Thanks for the plugin!!!, it doesn’t work in sketchup 2024, you can fix it

                      1 Reply Last reply Reply Quote 0
                      • SketcheldarS Offline
                        Sketcheldar
                        last edited by Rich O Brien

                        #Corrected code for plugin to work in SU 2024

                          @@colorx = "Black"
                          @@stipplex = "_"
                        
                          def initialize
                            @endpoints = false
                            @change = false
                            @colorlist = String.new
                            colorlist = Sketchup::Color.names
                            l = colorlist.size
                            l = l - 1
                            for e in 0..l do
                              @colorlist = @colorlist + colorlist[e].to_s + "|" if e != l
                              @colorlist = @colorlist + colorlist[e].to_s if e == l
                            end
                            cflag = false
                          end
                        
                          def activate
                            @model = Sketchup.active_model
                            @ents = @model.active_entities
                            @sel = @model.selection
                            @lines = []
                            show_status
                            conversion
                          end
                        
                          def show_status
                            statustext = "Edges into \"" + @@stipplex + "\" construction lines and cline to " + @@colorx + " edges (Command)" if !@change
                            statustext = "Construction lines into \"" + @@stipplex + "\" clines and edges into " + @@colorx + " edges (Command)" if @change
                            statusoption = "; Draw end points (Alt)" if @endpoints
                            statusoption = "; Endpoints not drawn (Alt)" if !@endpoints
                            status_label = statustext + statusoption
                            Sketchup.set_status_text(status_label, SB_PROMPT)
                          end
                        
                          def conversion
                            @model.start_operation "Line Conversion"
                            view = @model.active_view
                            if !@change
                              for e in @sel
                                if e.class == Sketchup::Edge
                                  lstart = e.start.position
                                  lend = e.end.position
                                  if @endpoints
                                    @ents.add_cpoint lstart
                                    @ents.add_cpoint lend
                                  end
                                  @ents.add_cline(lstart, lend, @@stipplex)
                                  @lines.push(e)
                                elsif e.class == Sketchup::ConstructionLine
                                  if e.start && e.end
                                    lstart = e.start.position
                                    lend = e.end.position
                                    if @endpoints
                                      @ents.add_cpoint lstart
                                      @ents.add_cpoint lend
                                    end
                                    @ents.add_edges(lstart, lend)
                                    @ents[-1].material = @@colorx.to_s
                                    @ents[-1].find_faces
                                    @lines.push(e)
                                  end
                                end # e.class
                              end # for e
                              if !@lines.empty?
                                @lines.each do |e|
                                  e.erase! if e.valid?
                                end
                              end
                            elsif @change
                              for e in @sel
                                if e.class == Sketchup::ConstructionLine
                                  e.stipple = @@stipplex
                                  if e.start && e.end
                                    lstart = e.start.position
                                    lend = e.end.position
                                    if @endpoints
                                      @ents.add_cpoint lstart
                                      @ents.add_cpoint lend
                                    end
                                  end
                                elsif e.class == Sketchup::Edge
                                  lstart = e.start.position
                                  lend = e.end.position
                                  if @endpoints
                                    @ents.add_cpoint lstart
                                    @ents.add_cpoint lend
                                  end
                                  e.material = @@colorx.to_s
                                end # e.class
                                view.invalidate
                              end # for e
                            end # @change
                            @sel.clear
                            @model.commit_operation
                          end
                        
                          def self.xLine_validate_selection_edge
                            Sketchup.active_model.selection.each {|e| return true if e.class == Sketchup::Edge}
                            return nil
                          end
                        
                          def self.xLine_validate_selection_xline
                            Sketchup.active_model.selection.each {|e| return true if (e.class == Sketchup::ConstructionLine && e.start && e.end)}
                            return nil
                          end
                        
                          def onKeyDown(key, repeat, flags, view)
                            if key == VK_COMMAND  ### Cmd toggles stipples and change
                              @change = !@change
                            end
                        
                            if key == VK_ALT ### Alt toggles end points
                              @endpoints = !@endpoints
                            end
                            show_status
                          end
                        
                          def onLButtonDown(flags, x, y, view)
                            ph = view.pick_helper
                            ph.do_pick(x, y)
                            best = ph.best_picked
                            @sel.add(best) if best
                            conversion
                          end
                        
                          def onRButtonDown(flags, x, y, view)
                            cflag = true if @@colorx == "Black"
                            list = ["-|.|-.-|_", @colorlist]
                            prompt = ["XLine Stipple: ", "Color: "]
                            values = [@@stipplex, @@colorx]
                            result = inputbox(prompt, values, list, "Change Parameters")
                            if result
                              @@stipplex = result[0].to_s
                              @@colorx = result[1].to_s
                              if cflag && @model.rendering_options["EdgeColorMode"] != 0
                                choice = UI.messagebox "The edges color will only be visible if you switch to \"display color by material\". Do you want to do this at this time?", MB_YESNOCANCEL
                                case choice
                                when 6
                                  @model.rendering_options["EdgeColorMode"] = 0 # sets up styles for Color By material
                                  cflag = false
                                when 7
                                  cflag = false
                                end
                              end # if cflag
                            end # if result
                            show_status
                            conversion
                          end
                        
                          def deactivate(view)
                            Sketchup.set_status_text("", SB_PROMPT)
                            Sketchup.set_status_text("", SB_VCB_LABEL)
                            Sketchup.set_status_text("", SB_VCB_VALUE)
                          end
                        end
                        
                        if !file_loaded?("XLinem.rb")
                          UI.add_context_menu_handler do |menu|
                            if XLinemTool.xLine_validate_selection_edge
                              menu.add_separator
                              menu.add_item("Convert to XLine") {Sketchup.active_model.select_tool(XLinemTool.new)}
                            elsif XLinemTool.xLine_validate_selection_xline
                              menu.add_separator
                              menu.add_item("Convert to Edge") {Sketchup.active_model.select_tool(XLinemTool.new)}
                            end
                          end
                        end
                        
                        unless file_loaded?(__FILE__)
                          cmd = UI::Command.new("xlinem Convert") {Sketchup.active_model.select_tool(XLinemTool.new)}
                          cmd.small_icon = File.join(File.dirname(__FILE__), "Xlinem", "Xline_SM.png")
                          cmd.large_icon = File.join(File.dirname(__FILE__), "Xlinem", "Xline_LG.png")
                          cmd.tooltip = "Construction Line Conversion"
                          tb = UI.toolbar("Line Conversion") # Fixed string termination
                          tb.add_item(cmd)
                          tb.restore
                        end```
                        TIGT F 2 Replies Last reply Reply Quote 1
                        • TIGT Offline
                          TIG Moderator @Sketcheldar
                          last edited by

                          @Sketcheldar
                          Because you haven't formatted your code properly it's unusable.
                          Use the </> button to add the correct 'Code' formatting...
                          Which is three ` at the start & end of your code, on a separate line.

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • F Offline
                            FlorinAp @Sketcheldar
                            last edited by

                            @Sketcheldar Something is wrong with this code...!!??

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

                              @FlorinAp
                              That code has never worked.
                              The code as presented applies to a Class [XLinemTool] which should be inside a Module.
                              No Class is defined.
                              There's no RB file to set up the extension as SketchUp loads, and the image PNGs are not in a folder with the main code.
                              There's also three trailing ` characters.

                              If the missing parts were supplied and the whole lot then packaged in an RBZ file, life would be much easier for every one...

                              TIG

                              F 1 Reply Last reply Reply Quote 0
                              • F Offline
                                FlorinAp @TIG
                                last edited by

                                @TIG Maybe somebody can do something about it, because right now we have no option to convert construction lines to edges (the reverse it is possible, at least with Curvizard).
                                I know only one option (DBur Guide Tools) but it can do only one line at a time....

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

                                Advertisement