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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    DXF layer names

    Scheduled Pinned Locked Moved Plugins
    3 Posts 2 Posters 162 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.
    • S Offline
      saunajumal
      last edited by

      I'm trying to use -Sketchup to DXF and STL convertor plugin- but it takes layer names from -Entity name-. What I need is it to create layer names from definition name (the same name you give to component at first).

      I found that this part of code is related but dont know how to change it:
      #Componentinstance entity
      elsif( entity.typename == "ComponentInstance")
      if entity.name==""
      entity.name="COMPONENT"+$component_count.to_s
      $component_count+=1
      end

      After some change I now have the code like that:
      #Componentinstance entity
      elsif( entity.typename == "ComponentInstance")
      if entity.name==""
      entity.name="LAYER NAME"
      end

      Can anybody tell how to change it and use definition name? Plugin can be found http://www.guitar-list.com/download-software/stl-dxf-converter

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

        Unfortunately it's perhaps much more complex than that.
        There are several methods def dxf_.... which are expecting an argument ' layername'
        In other methods the arguments passed place say entity.name for the 'layername'
        This is then used inside the method when calling other methods thus
        dxf_write_face(entity,tform,layername)
        Since at this point we are iterating an array named ' entities' we know ' entity', so you can substitute entity**.definition**.name instead ?
        Therefore

        elsif( entity.typename == "ComponentInstance")
                 if entity.name==""
                   entity.name="COMPONENT"+$component_count.to_s
                   $component_count+=1
                 end
                 others = dxf_find_faces(others, entity.definition.entities, tform * entity.transformation, entity.name,dxf_option)
              else
        

        becomes

        elsif( entity.typename == "ComponentInstance")
                 if entity.name==""
                   entity.name="COMPONENT"+$component_count.to_s
                   $component_count+=1
                 end
                 others = dxf_find_faces(others, entity.definition.entities, tform * entity.transformation, entity.definition.name,dxf_option)
              else
        

        The code also renames any unnamed instances - to stop that add ### in front of the entity.name= code etc...
        This might occur more than once you need to check through >90000 lines of code...

        TIG

        1 Reply Last reply Reply Quote 0
        • S Offline
          saunajumal
          last edited by

          Thanks, works perfectly for me - every component is on its own layer and CNC machine can read layers automatically for toolpaths.

          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