I've imported a dxf file in Mathematica
dxf = Import["input.dxf"]
The following graph is present in the dxf file available here.
The actual dimensions don't match the value displayed in the text label (in yellow) over the lines. For instance, 62 is the value displayed and 54.0833 is the actual dimension. And I want to rescale the actual lengths to the values displayed in yellow-colored label over the lines.
I understand the coordinates displayed in the input provided above have to be varied. Probably, the first coordinate can be fixed and the subsequent coordinates can be shifted.
I found a similar post here and I would like to try the solution posted there (also added below).
g = Graph[vertices, edges, EdgeWeight -> weights,
EdgeLabels -> MapThread[Rule, {edges, weights}],
GraphLayout -> {"LayeredEmbedding", "Orientation" -> Top,
"RootVertex" -> 1}, EdgeLabelStyle -> Directive[Blue, 20],
VertexLabels -> "Name"];
coords = GraphEmbedding[g];
update[1] = 0;
BreadthFirstScan[g, 1,
"DiscoverVertex" -> (w = PropertyValue[{g, #2 \[DirectedEdge] #1}, EdgeWeight];
If[NumberQ[w], update[#1] = update[#2] + w]; &)];
add = update /@ VertexList[g];
{x, y} = Transpose[coords];
y = y - add/50;
ncoord1 = Transpose[{x, y}];
ncoord2 = Transpose[{x,-add/25}];
SetProperty[g, VertexCoordinates -> ncoord1]
To try the above solution on the imported dxf, first I have to convert the dxf into a graph object after import. I am not sure how to convert dxf to graph object in Mathematica and I'd also like to know if the solution provided in the above-mentioned post can be used for my input.
Any suggestions on how to proceed will be really helpful.
EDIT: I'm trying to clarify here
What do I want to achieve?
Example: Actual edge length between nodes 7 and 6 : computed as euclidean distance between the coordinates of 7 and 6 is 54.08.
I want to scale this length to 62.
EDIT2: Adding additional details
If one directly loads the input file in AutoCAD, the yellow text displayed in the following image is the actual dimensions
And I want to convert the dimensions to the corresponding yellow labels displayed in the following image:
Addressing the following comment
It seems that the DXF file was saved in a perspective view, and that's why none of the edge labels match the lengths of the corresponding lines
The labels displayed in the second image in EDIT2 were altered externally using an AutoLISP code to merely show how the actual lengths of the corresponding lines have to be scaled. In the first image displayed in EDIT2, the edge labels exactly match the lengths of the corresponding lines.