Browse Source

add resources

divide_struct_def_imp
郑敬润 1 year ago
parent
commit
590936ca75
  1. 6884
      data/OBJ/tinyroute.obj
  2. 24237
      data/clip2/out3.xml
  3. 7
      data/connector.csv
  4. 25
      data/wirexml/W0024588_1514.xml
  5. 25
      parameters.txt
  6. 48
      src/xmlsql.cpp

6884
data/OBJ/tinyroute.obj

File diff suppressed because it is too large

24237
data/clip2/out3.xml

File diff suppressed because it is too large

7
data/connector.csv

@ -0,0 +1,7 @@
A1,3.58,-0.34662,1.5822
B1,1.82,-0.31271,1.6172
C1,2.18 ,0.243342,1.6181
D1,2.28,2.5863,1.6172
E1,3.3545,1.7318,1.6172
F1,1.37,1.3541,1.6172
END,1.7,2.0418,1.4672
1 A1 3.58 -0.34662 1.5822
2 B1 1.82 -0.31271 1.6172
3 C1 2.18 0.243342 1.6181
4 D1 2.28 2.5863 1.6172
5 E1 3.3545 1.7318 1.6172
6 F1 1.37 1.3541 1.6172
7 END 1.7 2.0418 1.4672

25
data/wirexml/W0024588_1514.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project PUBLIC "-//Mentor Graphics Corporation//Project 2014.1//EN" "D:/MentorGraphics/Capital/dtd/project.dtd">
<!-- Application Version: 2014.1.SP1610.27 [Build 4] - 25 September 2016 (17:59 IST)-->
<project>
<designmgr>
<harnessdesign>
<harnesscontainer>
<connectivity id="_1000">
<connector id="_1001" name="A1" partnumber="JY27467T21F41SN-S">
<pin id="_1002" name="sa1">
</pin>
</connector>
<connector id="_1021" name="END" partnumber="JY27467T21F41SA-U-S">
<pin id="_1022" name="end1">
</pin>
</connector>
<wire id="_2000" name="atoE" wirecsa="0.616" outsidediameter="1.415">
<connection pinref="_1002"/>
<connection pinref="_1022"/>
</wire>
</connectivity>
</harnesscontainer>
</harnessdesign>
</designmgr>
</project>

25
parameters.txt

@ -1,6 +1,21 @@
Raw paras:
createTinyroute
D:\SOURCE\WireRouting\Tinyroute_0520\clip2
D:\SOURCE\WireRouting\Tinyroute_0520\wirexml
D:\SOURCE\WireRouting\Tinyroute_0520\connector.csv
D:\SOURCE\WireRouting\Tinyroute_0520\OBJ
output
..\..\data\clip2
..\..\data\wirexml
..\..\data\connector.csv
..\..\data\OBJ
output
VScode CMake:
{
"cmake.debugConfig": {
"args": ["createTinyroute",
"..\\..\\data\\clip2",
"..\\..\\data\\wirexml",
"..\\..\\data\\connector.csv",
"..\\..\\data\\OBJ",
"output"]
}
}

48
src/xmlsql.cpp

@ -1,4 +1,4 @@
// xmlsql.cpp : �������̨Ӧ�ó������ڵ㡣
// xmlsql.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
@ -76,7 +76,7 @@ struct Readexcel{
}
}rexcel;
//��ȡ������
//读取卡箍点
void read_points(string filename,Astar * pastar){
//cout<<"read "<<filename<<endl;
vector<string>sl=rexcel.read(filename);
@ -87,7 +87,7 @@ void read_points(string filename,Astar * pastar){
{
string s1=sl[i+1],s2=sl[i+2],s0=sl[i];
//cout<<s0<<" "<<s1<<endl;//test
istringstream sin(s1),sin2(s2); //�������ַ���line���뵽�ַ�����istringstream��
istringstream sin(s1),sin2(s2); //将整行字符串line读入到字符串流istringstream中
P p1,p2;
sin>>p1.x>>p1.y>>p1.z;
@ -107,17 +107,17 @@ void read_points(string filename,Astar * pastar){
}
unsigned int extractAndConvert(const string& str) {
size_t pos = str.find("/"); // ���� "//" ���
size_t pos = str.find("/"); // 查找 "//" 的位置
if (pos == std::string::npos) {
throw invalid_argument("No '/' found in the string.");
}
string numberStr = str.substr(0, pos); // ��ȡ "//" ֮ǰ�IJ���
string numberStr = str.substr(0, pos); // 截取 "//" 之前的部分
char* endptr;
long number = strtol(numberStr.c_str(), &endptr, 10); // ʹ�� strtol ���ַ���ת��Ϊ long�������ת���Ƿ�ɹ�
long number = strtol(numberStr.c_str(), &endptr, 10); // 使用 strtol 将字符串转换为 long,并检查转换是否成功
if (endptr == numberStr.c_str() || *endptr != '\0' || number < 0 || static_cast<unsigned int>(number) != number) {
throw invalid_argument("Invalid input string for conversion to unsigned int.");
} // ���ת���Ƿ�ɹ����Լ�ֵ�Ƿ��� unsigned int �ķ�Χ��
return static_cast<unsigned int>(number); // ת��Ϊ unsigned int ������
} // 检查转换是否成功,以及值是否在 unsigned int 的范围内
return static_cast<unsigned int>(number); // 转换为 unsigned int 并返回
}
@ -129,26 +129,26 @@ bool read_OBJ(const string& filename,vector<Vec3f>& vertices,vector<Vec3u>& indi
}
string line;
while (getline(file, line)) {
// ���Կ��к�ע����
// 忽略空行和注释行
if (line.empty() || line.at(0) == '#') {
continue;
}
//std::cout<<line<<std::endl;
istringstream iss(line);
string token;
if (iss >> token && token == "v") {// ��������
if (iss >> token && token == "v") {// 解析顶点
float x, y, z;
iss >> x >> y >> z;
//std::cout<<"v:"<<x<<" "<<y<<" "<<z<<std::endl;
//std::cout<<"vertices_length"<<vertices.size()<<std::endl;
vertices.push_back(Vec3f(x,y,z));
}
else if (token == "f") {// �����棨����ֻ��ȡ����������
else if (token == "f") {// 解析面(这里只提取顶点索引)
//std::cout<<"enter_f"<<std::endl;
string v1_s,v2_s,v3_s;
unsigned int v1, v2, v3; // ͨ��һ�������������㶨��
unsigned int v1, v2, v3; // 通常一个面由三个顶点定义
if (!(iss >> v1_s >> v2_s >> v3_s)) {
// ��������������������������
// 处理非三角形面或其他错误情况
continue;
}
try {
@ -171,7 +171,7 @@ bool read_OBJ(const string& filename,vector<Vec3f>& vertices,vector<Vec3u>& indi
indices.push_back(Vec3u(v1,v2,v3));
}
//else std::cout<<token<<std::endl;
// �����������͵��У��編�ߡ���������ȣ�
// 忽略其他类型的行(如法线、纹理坐标等)
}
file.close();
return true;
@ -225,29 +225,29 @@ void produceXML(const char * xml,const char * connectorFile,string resultfile){
}
void getAllFiles(string path, vector<string>& files) {
//����
//文件句柄
long long hFile = 0;
//�ļ���Ϣ
//文件信息
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) {
do {
if ((fileinfo.attrib & _A_SUBDIR)) { //�Ƚ��ļ������Ƿ����ļ���
if ((fileinfo.attrib & _A_SUBDIR)) { //比较文件类型是否是文件夹
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) {
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
//�ݹ�����
//递归搜索
getAllFiles(p.assign(path).append("\\").append(fileinfo.name), files);
}
}
else {
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0); //Ѱ����һ�����ɹ�����0������-1
} while (_findnext(hFile, &fileinfo) == 0); //寻找下一个,成功返回0,否则-1
_findclose(hFile);
}
}
//��ʼ�������ṹ��
//初始化各个结构体
inline void init(){
kdtree.build();
cout<<"kdtree build Finish"<<endl;
@ -282,9 +282,9 @@ int _tmain(int argc, char * argv[])
string mode;
// cin>>mode;
mode = argv[1];
if(mode=="generateCATIA"){
//��ģʽΪ����ģʽ��ʹ����������ͨ��ģ��
//该模式为基本模式,使用它来生成通道模型
string clipDoc,xmlDoc,connectorFile,stlFileName,outputFileName;
cin>>clipDoc>>xmlDoc>>connectorFile>>stlFileName>>outputFileName;
vector<string> clipFileNames;
@ -324,7 +324,7 @@ int _tmain(int argc, char * argv[])
cout<<"ALL FINISH"<<endl;
}
else if(mode=="createChannel"){
//��ģʽ���ڸ��ݿ������λ�����ɽ���ͨ��
//该模式用于根据卡箍相对位置生成近似通道
string clipDoc,stlFileName,outputFileName;
cin>>clipDoc>>stlFileName>>outputFileName;
cout<<"mode = createChannel"<<endl;
@ -348,7 +348,7 @@ int _tmain(int argc, char * argv[])
}
//----------------------mark----------------------
else if(mode=="createTinyroute"){
//��ģʽΪ��С�ռ�ģʽ��ʹ������������С�ռ��·��
//该模式为狭小空间模式,使用它来生成狭小空间的路径
string clipDoc,xmlDoc,connectorFile,OBJDoc,outputFileName;
// cin>>clipDoc>>xmlDoc>>connectorFile>>OBJDoc>>outputFileName;
clipDoc = argv[2];

Loading…
Cancel
Save