|
@@ -25,6 +25,29 @@ public class FdJsonToDxfUtil {
|
|
|
|
|
|
/**
|
|
/**
|
|
* floorplan_user.json 转 dxf
|
|
* floorplan_user.json 转 dxf
|
|
|
|
+ * @param fdJsonPath floorplan.json 路径
|
|
|
|
+ * @param dxfPath dxf生成路径
|
|
|
|
+ * @param subgroup 多楼层,楼层数 floorplan中需存在
|
|
|
|
+ */
|
|
|
|
+ public static void fdJsonToDxf(String fdJsonPath,String dxfPath,Integer subgroup) {
|
|
|
|
+ try {
|
|
|
|
+ String msg = new String(Files.readAllBytes(Paths.get(fdJsonPath)));
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(msg);
|
|
|
|
+ JSONArray floors = jsonObject.getJSONArray("floors");
|
|
|
|
+ for (Object obj : floors) {
|
|
|
|
+ JSONObject floor = (JSONObject) (obj);
|
|
|
|
+ if(floor.getInteger("subgroup") != null && floor.getInteger("subgroup").equals(subgroup)){
|
|
|
|
+ plantWall(dxfPath,floor);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * floorplan_user.json 转 dxf
|
|
* @param fdJsonPath floorplan_user.json 路径
|
|
* @param fdJsonPath floorplan_user.json 路径
|
|
* @param dxfPath dxf生成路径
|
|
* @param dxfPath dxf生成路径
|
|
*/
|
|
*/
|
|
@@ -131,4 +154,10 @@ public class FdJsonToDxfUtil {
|
|
wallIndex ++;
|
|
wallIndex ++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ String inPath ="D:\\cad\\work\\111\\floorplan.json";
|
|
|
|
+ String outPath ="D:\\cad\\work\\111\\test1.dxf";
|
|
|
|
+ FdJsonToDxfUtil.fdJsonToDxf(inPath,outPath);
|
|
|
|
+ }
|
|
}
|
|
}
|