Open elgar328 opened 1 week ago
I’m currently using it as a temporary workaround.
fn save_step(solid: &Solid, path: &str) {
// compress solid data.
let compressed = solid.compress();
// step format display
let display = CompleteStepDisplay::new(StepModel::from(&compressed), Default::default());
// content of step file
let step_string: String = display.to_string();
let step_string = repair_step_syntax(step_string);
std::fs::write(path, &step_string).unwrap();
}
fn repair_step_syntax(input: String) -> String {
let mut result = String::new();
for line in input.lines() {
// Handle FILE_NAME
if line.starts_with("FILE_NAME") {
let modified_line = line.replace("((''))", "('')");
result.push_str(&modified_line);
}
// Handle UNCERTAINTY_MEASURE_WITH_UNIT
else if line.contains("UNCERTAINTY_MEASURE_WITH_UNIT(") {
let start_idx = line.find("UNCERTAINTY_MEASURE_WITH_UNIT(").unwrap();
let end_idx = line[start_idx..].find(",").unwrap() + start_idx;
let measure = &line[start_idx + "UNCERTAINTY_MEASURE_WITH_UNIT(".len()..end_idx];
let modified_measure = format!("LENGTH_MEASURE({})", measure);
let modified_line = line.replace(measure, &modified_measure);
result.push_str(&modified_line);
} else {
// Add other lines as is
result.push_str(line);
}
result.push('\n');
}
result
}
I ran the tutorial code to generate the cube.step file, and below is a portion of the file.
I imported this file into the FE analysis software and observed two warnings.
To eliminate the warnings, I manually modified the contents of the STEP file as follows:
I removed one set of parentheses, changing (('')), (('')) to (''), (''), and added a type() qualifier by changing 1.0E-6 to LENGTH_MEASURE(1.0E-6).
Is it possible to solve this issue?