How to specify dxf size in openscad?

I am new to opencad and trying to create a 3d model from a dxf file. I want to indicate its size as 130x130. I was able to bring to the code below, but it still does not approve the size that I want:

linear_extrude(height = 5, center = true, convexity = 10) import (file="bahtinov.dxf"); 

Any help is appreciated!

+4
source share
3 answers

You can use dxf_dim() : create an extra layer in your dxf, for example. "dimensions", draw a horizontal and vertical dimension line with max. width respectively. Max. height, as described in the Documentation , as an identifier, for example. "TotalWidth" and "TotalHeight", here is my test picture as an example:

dimension line with identifier

get values โ€‹โ€‹using:

 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 part:

 scale([130/tw,130/th,1]) linear_extrude(height = 5, center = true) import(file="bahtinov.dxf", layer="layerName", scale=1); 
+3
source

You can achieve this using resize () on imported DXF:

 linear_extrude(height = 5, center = true, convexity = 10) resize([130,130]) import (file="bahtinov.dxf"); 
+1
source

I donโ€™t think you can, but then you can scale it.

 scaling_factor=0.5; scale([scaling_factor,scaling_factor,1]) linear_extrude(height = 5, center = true, convexity = 10) import (file="bahtinov.dxf"); 
0
source

Source: https://habr.com/ru/post/1500210/


All Articles