DXF layer names
-
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
endAfter some change I now have the code like that:
#Componentinstance entity
elsif( entity.typename == "ComponentInstance")
if entity.name==""
entity.name="LAYER NAME"
endCan anybody tell how to change it and use definition name? Plugin can be found http://www.guitar-list.com/download-software/stl-dxf-converter
-
Unfortunately it's perhaps much more complex than that.
There are several methodsdef dxf_....
which are expecting an argument 'layername
'
In other methods the arguments passed place sayentity.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 substituteentity**.definition**.name
instead ?
Thereforeelsif( 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 theentity.name=
code etc...
This might occur more than once you need to check through >90000 lines of code... -
Thanks, works perfectly for me - every component is on its own layer and CNC machine can read layers automatically for toolpaths.
Advertisement