Tip for importing DWG into SketchUp
-
So there's always been an issue importing DWG's into SU, in particular i'm referring to importing curves. Since SU doesn't do real curves, the curves are imported as lines, and often not enough lines.
So I just imported a DWG into 3ds Max, then exported it as a DWG, and then imported it into SU and the results are a lot better. I know most people don't have SU and 3ds max, but it may be worth trying the same with some other 3d program like blender.
-brodie
-
If you import a DWG/DXF the arcs/circles will come in to the SKP as arcs/circles but with 24 segments only.
Before you do any more work you can select an arc/circle and in Entity Info change the number of segments.
I wrote to tool somewhere to change the segmentation of a selection of arcs/circles en mass.
Unfortunately you can't change segmentation if the arc/circle forms part of a 3d object - only if it's 2d or unfaced... -
Sounds like a good script. If you have a circle and an arc, does it give them equal segments? Or if the arc starts with 12 segments will it know to give it less segments than a circle? Does that make any sense? If you can post a link to it that would be awesome.
-brodie
-
@unknownuser said:
Sounds like a good script. If you have a circle and an arc, does it give them equal segments? Or if the arc starts with 12 segments will it know to give it less segments than a circle? Does that make any sense? If you can post a link to it that would be awesome.
-brodie
Brodie you are a lazy ***
You can't do an 'advanced search' for TIG & segment ?
http://forums.sketchucation.com/viewtopic.php?p=158903#p158903
-
-
There is also a cad script called qbrick that will break all circles and arcs in CAD. They get broken at every intersection, which is really what you probably want (though it can cause over-segmentation). It can come in quite handy, though I always have a hard time finding the link to download it....
-
I found it here http://freecadapps.mcadcafe.com/swdetails.php?page=category&value=ACG-ARX&orgvalue=ACG&review=5388&rowcolor=fce08d
I'll give it a shot. It sounds like that's basically what my method does, but if this works, it'd save the step of going thru 3ds max.
I took a look at TIG's ruby, but didn't really understand it or what I was supposed to do so I gave up (as has already been determined, I'm quite lazy). I gathered that it's a ruby but that you may have to go in and manually alter values in the .rb file or something. Not real sure, but it didn't seem like something I'd remember.
-Brodie
-
As for my tool - there's a simplified version for the hard-of-learning...
changearcsegments 36
Select some arcs/circles and type it into the Ruby Console to make every one selected with 36 segments.
To change the number of segments change the 'number'.All you have to remember is to:
Select what you want to change
Typechangearcsegments NNN
.......... -
First of all: I am NOT a programmer, so there is ZERO error handling on this quick-and dirty script. I had tried TIG's solution, but did not work on my DWG because some of the arcs would "clip" others as they were rebuilt by the script.
So I wrote this small routine to:
- loop through imported AutoCAD entities.
- select curves and group them (individually)
- create a more refined clone of the curve (the number of segments is controlled by two parameters. See script)
- Delete the original curve.
Anyone is welcome to turn this snippet into something better and more reusable.
Best,
Marcos.
theModel = Sketchup.active_model
#selEntities = theModel.selectiontheModel.selection.clear
allEntities = theModel.entitiesCollect user values:
prompts = ["Minimum number of segments:", "Minimum Segment Length:"]
defaults = [36, 10]
input = UI.inputbox(prompts, defaults, "Enter Desired Settings")#set minimum length for each arc segment (in model units)
userSegs = input[0]
minLen = input[1]#UI.messagebox(userSegs.to_s)
#UI.messagebox(minLen.to_s)allEntities.each do |i|
if (i.typename == "Edge")
aCurve = i.curve
if (aCurve)
Sel = theModel.selection unless defined?(Sel)
Sel.add (aCurve.edges)
newGroup = allEntities.add_group (theModel.selection)
Sel.clear
else
#not a Curve
end
end
endtheModel = Sketchup.active_model
theModel.selection.clear
allEntities = theModel.entitiesLoop through all entities
allEntities.each do |i|
#open Groups, search for Curves if (i.typename == "Group") #Loop through array of Entities inside each Group subset = i.entities subset.each do |s| curve = s.curve # if it is a curve, collect a few properties if (curve) # get coord. transformation, since entities are in a group #use "transform" below to translate to global coordinates tr=i.transformation cCenter = curve.center.transform! (tr) cSangle = curve.start_angle cEangle = curve.end_angle cRadius = curve.radius cNormal = curve.normal.transform! (tr) cXaxis = curve.xaxis.transform! (tr) cYaxis = curve.yaxis.transform! (tr) cLength = curve.length #UI.messagebox(" Curve Length is " + cLength.to_s) #divides arcs in minLen(model unit) increments divSegs = (cLength / minLen).to_i #UI.messagebox("Divided Result is " + divSegs.to_s) #for very small arcs, sets a minimum number of segments if (divSegs <= userSegs) numSegs = userSegs # UI.messagebox("Using: " + numSegs.to_s) else #subdivides larger arcs using target length numSegs = divSegs.to_i # UI.messagebox("using Divided total" + numSegs.to_s) end myarc = allEntities.add_arc cCenter,cXaxis,cNormal,cRadius,cSangle,cEangle,numSegs #Erases original i.erase! end # if curve end # entities inside group loop end # if it is a group
end #loop through all entities
Advertisement