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.namefor 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**.nameinstead ?
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) elsebecomes
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) elseThe 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement