Convert measurement units

Good day.
Is there a way to convert the DVG files from inches to meters before working with it? I know that there is a way to set the desired measurement system when, for example, converting DWG to PDF, but I need a way to change the measurement system so that it changes for all elements - image.getEntities ()?

@hliakau

Can you pease share in detail that what actually you want to achieve using API as unfortunately, it is not evident for us. It will be great if you may please provide a drawing and your high level goal. We will try to provide snippet based on that.

Hi, @mudassir.fayyaz!
Let’s assume I have this DWG (attached file) that contains only one line (just for simplicity). The unit type (measurement unit) of the image is cm (centimeters). So, when I get this line with API, for example:

    final CadLine line = (CadLine) Arrays.stream(cadImage.getEntities()).findFirst().get();
    final double x = line.getSecondPoint().getX();
    final double y = line.getSecondPoint().getY();

As a result:
x = 100;
y = 10;

I need to convert the file’s unit type (measurement unit) from centimeters to meters. So, I need to get this output:
x = 1;
y = 0.1;

Line_in_cm.7z (13.5 KB)

@hliakau

We need to investigate the requirement further on our end and a ticket with ID CADJAVA-10194 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thank you, @mudassir.fayyaz

@hliakau

We have investigated the requirement on our end. Unfortunately, if it is required to change values inside each entity like it is described in the task, it can be done only by conversion of each value separately according to math.