Reputation: 430
I am new to openscad and trying to make a 3d model from a dxf file. I want to specify its size as 130x130. I've been able to get as far as the code below but it still does not assert the size I want:
linear_extrude(height = 5, center = true, convexity = 10) import (file="bahtinov.dxf");
Any help is appreciated!
Upvotes: 4
Views: 2387
Reputation: 435
You can achieve this by using resize() on the imported DXF:
linear_extrude(height = 5, center = true, convexity = 10) resize([130,130]) import (file="bahtinov.dxf");
Upvotes: 1
Reputation: 4286
You can use dxf_dim()
: create a further layer in your dxf, e.g. "dimensions", draw a horizontal and a vertical dimension line with the max. width resp. the max. height as described in Documentation, as identifier e.g. "TotalWidth" and "TotalHeight", here my test-drawing as example:
get the values with:
tw = dxf_dim(file="bahtinov.dxf", name="TotalWidth", layer="dimensions", scale=1);
th = dxf_dim(file="bahtinov.dxf", name="TotalHeight", layer="dimensions", scale=1);
scale the part:
scale([130/tw,130/th,1]) linear_extrude(height = 5, center = true) import(file="bahtinov.dxf", layer="layerName", scale=1);
Upvotes: 3
Reputation: 5495
I don't think you can, but you can scale it afterwards.
scaling_factor=0.5;
scale([scaling_factor,scaling_factor,1])
linear_extrude(height = 5, center = true, convexity = 10) import (file="bahtinov.dxf");
Upvotes: 0