CATIA-Makro in Anhang eingebaut
This commit is contained in:
532
datas/Create_CATIA_Makro.m
Executable file
532
datas/Create_CATIA_Makro.m
Executable file
@@ -0,0 +1,532 @@
|
||||
clc, clear all
|
||||
%
|
||||
% CONFIGURATION
|
||||
mirrowed = true;
|
||||
plotPoints = false;
|
||||
beginAtSection = 7;
|
||||
|
||||
if mirrowed==true
|
||||
catiaFileName = 'Rotorblatt-NREL1.CATPart';
|
||||
else
|
||||
catiaFileName = 'Rotorblatt-NREL1_NichtGespiegelt.CATPart';
|
||||
end
|
||||
catiaFile = strcat(pwd,'\',catiaFileName);
|
||||
% 18 more planes
|
||||
planeDistances = [7000, 8333.3, 10500, 13500, 18500, 19950, 22000, 26100, ...
|
||||
32250, 33500, 38500, 40450, 42500, 43500, 46500, 48650, 56166.7, 58900]; % in mm
|
||||
%
|
||||
% KEYPOINTS
|
||||
fid = fopen('keypointsTemp.txt');
|
||||
j = 1;
|
||||
while ~feof(fid)
|
||||
keypoints(j,:) = textscan(fid, '%s %f %f %f %f',1,'headerlines',0,'Delimiter',',','EmptyValue',0);
|
||||
j = j+1;
|
||||
end
|
||||
keypoints = keypoints(:,2:end);
|
||||
keypoints = cell2mat(keypoints);
|
||||
%
|
||||
% SECTIONS
|
||||
fid = fopen('sectionsTemp2.txt');
|
||||
j = 1;
|
||||
while ~feof(fid)
|
||||
sectionKeypoints(j,:) = textscan(fid, '%s %d %d %d %d %d',1,'headerlines',0,'Delimiter',',','EmptyValue',0);
|
||||
for i = 1:2
|
||||
fgets(fid);
|
||||
end
|
||||
j = j+1;
|
||||
end
|
||||
sectionKeypoints = sectionKeypoints(:,2:end);
|
||||
sectionKeypoints(:,end) = [];
|
||||
sectionKeypoints = cell2mat(sectionKeypoints);
|
||||
% results(:)
|
||||
uniqueSectionKeypoints = unique(sectionKeypoints(:));
|
||||
%
|
||||
% KEYPOINTS AND SECTIONS
|
||||
iskeypointInSection = (ismember(keypoints(:,1) , uniqueSectionKeypoints));
|
||||
j = 1;
|
||||
for i=1:length(iskeypointInSection)
|
||||
if isequal(iskeypointInSection(i),true)
|
||||
keypointInSection(j,:) = keypoints(i,:);
|
||||
j = j+1;
|
||||
end
|
||||
end
|
||||
keypointInSectionIDs = keypointInSection(:,1);
|
||||
keypointInSection = keypointInSection(:,2:end)*1000;
|
||||
% 2866.7 entfernung Nabe - Spinnerkontaktflaeche zu Rotorblatt
|
||||
zOffset = 2866.7 - 1366.7;
|
||||
keypointInSection(:,3) = keypointInSection(:,3) + zOffset;
|
||||
if mirrowed==true
|
||||
theta = 180;
|
||||
R = [cosd(theta), 0, -sind(theta);
|
||||
0, 1, 0;
|
||||
sind(theta), 0, cosd(theta)];
|
||||
keypointInSection = keypointInSection*R;
|
||||
else
|
||||
keypointInSection(:,1) = -1*keypointInSection(:,1);
|
||||
end
|
||||
if plotPoints == true
|
||||
scatter3(keypointInSection(:,1), keypointInSection(:,2), keypointInSection(:,3));
|
||||
axis equal
|
||||
end
|
||||
%
|
||||
% LINES
|
||||
fid = fopen('linesTemp.txt');
|
||||
j = 1;
|
||||
while ~feof(fid)
|
||||
lines(j,:) = textscan(fid, '%s %f %f %s',1,'headerlines',0,'Delimiter',',','EmptyValue',0);
|
||||
j = j+1;
|
||||
end
|
||||
lines = lines(:,2:3);
|
||||
lines = cell2mat(lines);
|
||||
combineLines{1} = [10801,10901,...
|
||||
11001,11101,11201,11301,11401,11501,11601,11701,11801,11901,...
|
||||
12001,12101,12201,12301,12401,12501,12601,12701,12801];
|
||||
combineLines{2} = [10802,10902,...
|
||||
11002,11102,11202,11302,11402,11502,11602,11702,11802,11902,...
|
||||
12002,12102,12202,12302,12402,12502,12602,12702,12802,...
|
||||
12901,...
|
||||
13001,13101,13201,13301,13401,13501,13601,13701];
|
||||
combineLines{3} = [10803,10903,...
|
||||
11003,11103,11203,11303,11403,11503,11603,11703,11803,11903,...
|
||||
12003,12103,12203,12303,12403,12503,12603,12703,12803,...
|
||||
12902,...
|
||||
13002,13102];
|
||||
combineLines{4} = [10804,10904,...
|
||||
11004,11104,11204,11304,11404,11504,11604,11704,11804,11904,...
|
||||
12004,12104,12204,12304,12404,12504,12604,12704,12804,...
|
||||
12903,...
|
||||
13003,13103,...
|
||||
13202,13302,13402,13502,13602,13702];
|
||||
combineLines{5} = [10805,10905,...
|
||||
11005,11105,11205,11305,11405,11505,11605,11705,11805,11905,...
|
||||
12005,12105,12205,12305,12405,12505,12605,12705,12805,...
|
||||
12904,...
|
||||
13004,13104,...
|
||||
13203,13303,13403,13503,13603,13703];
|
||||
combineLines{6} = [10806,10906,...
|
||||
11006,11106,11206,11306,11406,11506,11606,11706,11806,11906,...
|
||||
12006,12106,12206,12306,12406,12506,12606,12706,12806,...
|
||||
12905,...
|
||||
13005,13105,...
|
||||
13204,13304,13404,13504,13604,13704];
|
||||
% already in model
|
||||
% combineLines{7} = [10807,10907,...
|
||||
% 11007,11107,11207,11307,11407,11507,11607,11707,11807,11907,...
|
||||
% 12007,12107,12207,12307,12407,12507,12607,12707,12807,...
|
||||
% 12906,...
|
||||
% 13006,13106,...
|
||||
% 13205,13305,13405,13505,13605,13705];
|
||||
combineLines{8} = [10808,10908,...
|
||||
11008,11108,11208,11308,11408,11508,11608,11708,11808,11908,...
|
||||
12008,12108,12208,12308,12408,12508,12608,12708,12808,...
|
||||
12907,...
|
||||
13007,13107,...
|
||||
13206,13306,13406,13506,13606,13706];
|
||||
combineLines{9} = [10809,10909,...
|
||||
11009,11109,11209,11309,11409,11509,11609,11709,11809,11909,...
|
||||
12009,12109,12209,12309,12409,12509,12609,12709,12809,...
|
||||
12908,...
|
||||
13008,13108,...
|
||||
13207,13307,13407,13507,13607,13707];
|
||||
combineLines{10} = [10810,10910,...
|
||||
11010,11110,11210,11310,11410,11510,11610,11710,11810,11910,...
|
||||
12010,12110,12210,12310,12410,12510,12610,12710,12810,...
|
||||
12909,...
|
||||
13009,13109,...
|
||||
13208,13308,13408,13508,13608,13708];
|
||||
combineLines{11} = [10811,10911,...
|
||||
11011,11111,11211,11311,11411,11511,11611,11711,11811,11911,...
|
||||
12011,12111,12211,12311,12411,12511,12611,12711,12811,...
|
||||
12910,...
|
||||
13010,13110];
|
||||
combineLines{12} = [10812,10912,...
|
||||
11012,11112,11212,11312,11412,11512,11612,11712,11812,11912,...
|
||||
12012,12112,12212,12312,12412,12512,12612,12712,12812,...
|
||||
12911,...
|
||||
13011,13111,13209,13309,13409,13509,13609,13709];
|
||||
combineLines{13} = [10813,10913,...
|
||||
11013,11113,11213,11313,11413,11513,11613,11713,11813,11913,...
|
||||
12013,12113,12213,12313,12413,12513,12613,12713,12813];
|
||||
%
|
||||
% hybridBodies
|
||||
% 1 Querschnittsebenen
|
||||
% 2 variable temporary set; Flaechen (old), Abschnittstrennungen
|
||||
% 3 Abschnittstrennungen
|
||||
% 4 Gesamtoberflaeche
|
||||
% 5 Spiegelung (old)
|
||||
% 6 Punkte
|
||||
% 7 Abschnittslinien
|
||||
fileID = fopen('Makro_open_file_and_create_elements.catvbs','w');
|
||||
% begin of file
|
||||
fprintf(fileID,[...
|
||||
'Language="VBSCRIPT"\r\n\r\n'...
|
||||
'Sub CATMain()\r\n'...
|
||||
'CATIA.RefreshDisplay = False\r\n\r\n'...
|
||||
'Set partDocument1 = CATIA.Documents.Open("%s")\r\n'...
|
||||
'Set selection1 = partDocument1.Selection\r\n'...
|
||||
'Set visPropertySet1 = selection1.VisProperties\r\n'...
|
||||
'Set part1 = partDocument1.Part\r\n\r\n'], catiaFile);
|
||||
% create planes
|
||||
fprintf(fileID,[...
|
||||
'Set hybridBodies1 = part1.HybridBodies\r\n'...
|
||||
'Set hybridBody1 = hybridBodies1.Add()\r\n'...
|
||||
'hybridBody1.Name = "Querschnittsebenen"\r\n'...
|
||||
'part1.Update\r\n\r\n'...
|
||||
'Set hybridShapeFactory1 = part1.HybridShapeFactory\r\n\r\n'...
|
||||
'Set originElements1 = part1.OriginElements\r\n'...
|
||||
'Set hybridShapePlaneExplicit1 = originElements1.PlaneXY\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1)\r\n\r\n']);
|
||||
numberOfPlanes = length(planeDistances);
|
||||
for i=1:numberOfPlanes
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapePlaneOffset1 = '...
|
||||
'hybridShapeFactory1.AddNewPlaneOffset(reference1, %f, False)\r\n'...
|
||||
'hybridShapePlaneOffset1.Name = "Ebene.10%02d"\r\n'...
|
||||
'hybridBody1.AppendHybridShape hybridShapePlaneOffset1\r\n'...
|
||||
'part1.InWorkObject = hybridShapePlaneOffset1\r\n'...
|
||||
'part1.Update\r\n\r\n'], planeDistances(i), i);
|
||||
end
|
||||
% get whole surface
|
||||
fprintf(fileID,...
|
||||
'Set hybridShapes1 = hybridBody1.HybridShapes\r\n\r\n');
|
||||
% cut on planes
|
||||
fprintf(fileID,[...
|
||||
'Set hybridBody3 = hybridBodies1.Add()\r\n'...
|
||||
'hybridBody3.Name = "Abschnittstrennungen"\r\n'...
|
||||
'part1.Update\r\n']);
|
||||
for i=1:numberOfPlanes
|
||||
if i==1
|
||||
fprintf(fileID,[...
|
||||
'Set hybridBody2 = hybridBodies1.Item("Flaechen")\r\n'...
|
||||
'Set hybridShapes2 = hybridBody2.HybridShapes\r\n'...
|
||||
'Set hybridShapeAssemble2 = hybridShapes2.Item("Verbindung.16")\r\n']);
|
||||
elseif i==2
|
||||
fprintf(fileID,[...
|
||||
'Set hybridBody2 = hybridBodies1.Item("Abschnittstrennungen")\r\n'...
|
||||
'Set hybridShapes2 = hybridBody2.HybridShapes\r\n'...
|
||||
'Set hybridShapeAssemble2 = hybridShapes2.Item("Trennen.10%02dr")\r\n'],i-1);
|
||||
else
|
||||
fprintf(fileID,'Set hybridShapeAssemble2 = hybridShapes2.Item("Trennen.10%02dr")\r\n',i-1);
|
||||
end
|
||||
fprintf(fileID,[...
|
||||
'Set reference1 = part1.CreateReferenceFromObject( hybridShapeAssemble2)\r\n'...
|
||||
'Set hybridShapePlaneOffset1 = hybridShapes1.Item("Ebene.10%02d")\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject( hybridShapePlaneOffset1)\r\n\r\n'...
|
||||
'Set hybridShapeSplit1 = hybridShapeFactory1.AddNewHybridSplit(reference1, reference2, -1)\r\n'...
|
||||
'hybridShapeFactory1.GSMVisibility reference1, 0\r\n'...
|
||||
'hybridShapeSplit1.Name = "Trennen.10%02d"\r\n'...
|
||||
'hybridBody3.AppendHybridShape hybridShapeSplit1\r\n'...
|
||||
'part1.InWorkObject = hybridShapeSplit1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'part1.Update\r\n'],i,i);
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapeSplit1 = hybridShapeFactory1.AddNewHybridSplit(reference1, reference2, 1)\r\n'...
|
||||
'hybridShapeFactory1.GSMVisibility reference1, 0\r\n'...
|
||||
'hybridShapeSplit1.Name = "Trennen.10%02dr"\r\n'...
|
||||
'hybridBody3.AppendHybridShape hybridShapeSplit1\r\n'...
|
||||
'part1.InWorkObject = hybridShapeSplit1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'part1.Update\r\n\r\n'], i);
|
||||
end
|
||||
% combine sections
|
||||
fprintf(fileID,[...
|
||||
'Set hybridBody4 = hybridBodies1.Add()\r\n'...
|
||||
'hybridBody4.Name = "Gesamtoberflaeche"\r\n'...
|
||||
'part1.Update\r\n']);
|
||||
for i=1:numberOfPlanes
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapeSplit1 = hybridShapes2.Item("Trennen.10%02d")\r\n'...
|
||||
'Set reference%d = part1.CreateReferenceFromObject(hybridShapeSplit1)\r\n'],i,i);
|
||||
if i==2
|
||||
fprintf(fileID,'Set hybridShapeAssemble1 = hybridShapeFactory1.AddNewJoin(reference1, reference2)\r\n');
|
||||
elseif i>2
|
||||
fprintf(fileID,'hybridShapeAssemble1.AddElement reference%d\r\n',i);
|
||||
end
|
||||
fprintf(fileID,'\r\n');
|
||||
end
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapeSplit1 = hybridShapes2.Item("Trennen.10%02dr")\r\n'...
|
||||
'Set reference%d = part1.CreateReferenceFromObject(hybridShapeSplit1)\r\n'...
|
||||
'hybridShapeAssemble1.AddElement reference%d\r\n\r\n'...
|
||||
'hybridShapeAssemble1.SetConnex 1\r\n'...
|
||||
'hybridShapeAssemble1.SetManifold 1\r\n'...
|
||||
'hybridShapeAssemble1.SetSimplify 0\r\n'...
|
||||
'hybridShapeAssemble1.SetSuppressMode 0\r\n'...
|
||||
'hybridShapeAssemble1.SetDeviation 0.001000\r\n'...
|
||||
'hybridShapeAssemble1.SetAngularToleranceMode 0\r\n'...
|
||||
'hybridShapeAssemble1.SetAngularTolerance 0.500000\r\n'...
|
||||
'hybridShapeAssemble1.SetFederationPropagation 0\r\n'...
|
||||
'hybridShapeAssemble1.Name = "Verbindung.1001"\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeAssemble1\r\n'...
|
||||
'part1.InWorkObject = hybridShapeAssemble1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'part1.Update\r\n'], i, i+1, i+1);
|
||||
if mirrowed==true
|
||||
fprintf(fileID,[...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapeAssemble1)\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1)\r\n'...
|
||||
'Set hybridShapeSymmetry1 = hybridShapeFactory1.AddNewSymmetry(reference1, reference2)\r\n'...
|
||||
'hybridShapeSymmetry1.VolumeResult = False\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeSymmetry1\r\n'...
|
||||
'part1.InWorkObject = hybridShapeSymmetry1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'Set hybridBody5 = hybridBodies1.Item("Spiegelung")\r\n'...
|
||||
'selection1.Add hybridBody5\r\n'...
|
||||
'selection1.Add hybridShapeAssemble1\r\n']);
|
||||
end
|
||||
fprintf(fileID,'\r\n');
|
||||
% create Points
|
||||
fprintf(fileID,[...
|
||||
'Set hybridBody6 = hybridBodies1.Add()\r\n'...
|
||||
'hybridBody6.Name = "Punkte"\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'Set axisSystems1 = part1.AxisSystems\r\n'...
|
||||
'Set axisSystem1 = axisSystems1.Item("Achsensystem 0")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(axisSystem1)\r\n\r\n']);
|
||||
for i=1:length(keypointInSectionIDs)
|
||||
sectionID = int8(keypointInSectionIDs(i)/1000)+1;
|
||||
if sectionID > beginAtSection
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(%f, %f, %f)\r\n'...
|
||||
'hybridShapePointCoord1.RefAxisSystem = reference1\r\n'...
|
||||
'hybridBody6.AppendHybridShape hybridShapePointCoord1\r\n'...
|
||||
'hybridShapePointCoord1.Name = "Punkt.1%05d"\r\n'...
|
||||
'part1.InWorkObject = hybridShapePointCoord1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'\r\n'],keypointInSection(i,:),keypointInSectionIDs(i));
|
||||
end
|
||||
end
|
||||
myKeypoints = [ 0,0,2870; 0,0,42500; 0,0,46500; 0,0,63000];
|
||||
if mirrowed == true
|
||||
myKeypoints = -myKeypoints;
|
||||
end
|
||||
for i=1:length(myKeypoints(:,1))
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(%f, %f, %f)\r\n'...
|
||||
'hybridShapePointCoord1.RefAxisSystem = reference1\r\n'...
|
||||
'hybridBody6.AppendHybridShape hybridShapePointCoord1\r\n'...
|
||||
'hybridShapePointCoord1.Name = "Punkt.19%04d"\r\n'...
|
||||
'part1.InWorkObject = hybridShapePointCoord1\r\n'...
|
||||
'part1.Update\r\n\r\n'], myKeypoints(i,:), i);
|
||||
end
|
||||
% create Lines
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapes6 = hybridBody6.HybridShapes\r\n'...
|
||||
'Set hybridBody7 = hybridBodies1.Add()\r\n'...
|
||||
'hybridBody7.Name = "Abschnittslinien"\r\n\r\n']);
|
||||
sectionID = 0;
|
||||
for i=1:length(lines)
|
||||
newSectionID = int8(lines(i,1)/1000)+1;
|
||||
if newSectionID > sectionID
|
||||
j = 1;
|
||||
end
|
||||
sectionID = newSectionID;
|
||||
if sectionID > beginAtSection
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapePointCoord1 = hybridShapes6.Item("Punkt.1%05d")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)\r\n'...
|
||||
'Set hybridShapePointCoord2 = hybridShapes6.Item("Punkt.1%05d")\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord2)\r\n'...
|
||||
'Set hybridShapeLinePtPt1 = hybridShapeFactory1.AddNewLinePtPt(reference1, reference2)\r\n'...
|
||||
'hybridBody7.AppendHybridShape hybridShapeLinePtPt1\r\n'...
|
||||
'hybridShapeLinePtPt1.Name = "Linie.1%02d%02d"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeLinePtPt1\r\n'...
|
||||
'part1.Update\r\n\r\n'],lines(i,1),lines(i,2),sectionID,j);
|
||||
end
|
||||
j = j+1;
|
||||
end
|
||||
jump1 = beginAtSection*14;
|
||||
jump2 = 28*14;
|
||||
jump3 = jump2+3*12;
|
||||
myLines(:,1) = keypointInSectionIDs([jump1+2:jump1+7,jump1+9:jump1+14]);
|
||||
myLines(:,2) = ones(length(keypointInSectionIDs([2:7,9:14])),1)*90001;
|
||||
myLines = [myLines;
|
||||
[keypointInSectionIDs(jump2+2);
|
||||
keypointInSectionIDs(end-8);
|
||||
keypointInSectionIDs(jump3+2);
|
||||
keypointInSectionIDs([end-7:end-5,end-3:end-1]);
|
||||
keypointInSectionIDs(jump3+10);
|
||||
keypointInSectionIDs(end);
|
||||
keypointInSectionIDs(jump2+12)],...
|
||||
[90002;
|
||||
90004;
|
||||
90003;
|
||||
ones(length(keypointInSectionIDs([end-7:end-5, end-3:end-1])), 1)*90004;
|
||||
90003;
|
||||
90004;
|
||||
90002]];
|
||||
myLines(end+1,:) = [90001,90002];
|
||||
myLines(end+1,:) = [90002,90003];
|
||||
myLines(end+1,:) = [90003,90004];
|
||||
sectionID = 0;
|
||||
for i=1:length(myLines)
|
||||
newSectionID = int8(myLines(i,1)/1000)+1;
|
||||
if newSectionID > sectionID
|
||||
j = 1;
|
||||
end
|
||||
sectionID = newSectionID;
|
||||
if sectionID > beginAtSection
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapePointCoord1 = hybridShapes6.Item("Punkt.1%05d")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)\r\n'...
|
||||
'Set hybridShapePointCoord2 = hybridShapes6.Item("Punkt.1%05d")\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord2)\r\n'...
|
||||
'Set hybridShapeLinePtPt1 = hybridShapeFactory1.AddNewLinePtPt(reference1, reference2)\r\n'...
|
||||
'hybridBody7.AppendHybridShape hybridShapeLinePtPt1\r\n'...
|
||||
'hybridShapeLinePtPt1.Name = "Linie.2%02d%02d"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeLinePtPt1\r\n'...
|
||||
'part1.Update\r\n\r\n'],myLines(i,1),myLines(i,2),sectionID,j);
|
||||
end
|
||||
j = j+1;
|
||||
end
|
||||
% combine lines
|
||||
fprintf(fileID,'Set hybridShapes7 = hybridBody7.HybridShapes\r\n');
|
||||
k = 1;
|
||||
for i=1:length(combineLines)
|
||||
if ~isempty(combineLines{i})
|
||||
for j=1:length(combineLines{i})
|
||||
fprintf(fileID,'Set hybridShapeLinePtPt1 = hybridShapes7.Item("Linie.%d")\r\n',combineLines{i}(j));
|
||||
fprintf(fileID,'Set reference%d = part1.CreateReferenceFromObject(hybridShapeLinePtPt1)\r\n',j);
|
||||
if j==2
|
||||
fprintf(fileID,'Set hybridShapeAssemble1 = hybridShapeFactory1.AddNewJoin(reference1, reference2)\r\n');
|
||||
elseif j>2
|
||||
fprintf(fileID,'hybridShapeAssemble1.AddElement reference%d\r\n',j);
|
||||
end
|
||||
fprintf(fileID,'\r\n');
|
||||
end
|
||||
fprintf(fileID,[...
|
||||
'hybridShapeAssemble1.SetConnex 1\r\n'...
|
||||
'hybridShapeAssemble1.SetManifold 1\r\n'...
|
||||
'hybridShapeAssemble1.SetSimplify 0\r\n'...
|
||||
'hybridShapeAssemble1.SetSuppressMode 0\r\n'...
|
||||
'hybridShapeAssemble1.SetDeviation 0.001000\r\n'...
|
||||
'hybridShapeAssemble1.SetAngularToleranceMode 0\r\n'...
|
||||
'hybridShapeAssemble1.SetAngularTolerance 0.500000\r\n'...
|
||||
'hybridShapeAssemble1.SetFederationPropagation 0\r\n'...
|
||||
'hybridShapeAssemble1.Name = "Verbindung.11%02d"\r\n'...
|
||||
'hybridBody7.AppendHybridShape hybridShapeAssemble1\r\n'...
|
||||
'part1.InWorkObject = hybridShapeAssemble1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'part1.Update\r\n\r\n'], k);
|
||||
k = k+1;
|
||||
end
|
||||
end
|
||||
% sweep combined lines
|
||||
for i=[1:3,6:7,10:12]
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapeLinePtPt1 = hybridShapes7.Item("Linie.208%02d")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapeLinePtPt1)\r\n'...
|
||||
'Set hybridShapeDirection1 = hybridShapeFactory1.AddNewDirection(reference1)\r\n'...
|
||||
'Set hybridShapeAssemble1 = hybridShapes7.Item("Verbindung.11%02d")\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapeAssemble1)\r\n'...
|
||||
'Set hybridShapeExtrude1 = hybridShapeFactory1.AddNewExtrude(reference2, 150.000000, 400.000000, hybridShapeDirection1)\r\n'...
|
||||
'hybridShapeExtrude1.SymmetricalExtension = 0\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeExtrude1\r\n'...
|
||||
'hybridShapeExtrude1.Name = "Extrudieren.10%02d"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeExtrude1\r\n'...
|
||||
'part1.Update\r\n\r\n'],i,i,i);
|
||||
end
|
||||
% Shear Web
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapeLoft1 = hybridShapeFactory1.AddNewLoft()\r\n'...
|
||||
'hybridShapeLoft1.SectionCoupling = 1\r\n'...
|
||||
'hybridShapeLoft1.Relimitation = 1\r\n'...
|
||||
'hybridShapeLoft1.CanonicalDetection = 2\r\n'...
|
||||
'Set hybridShapeAssemble1 = hybridShapes7.Item("Verbindung.1104")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapeAssemble1)\r\n'...
|
||||
'hybridShapeLoft1.AddSectionToLoft reference1, 1, Nothing\r\n'...
|
||||
'Set hybridShapeAssemble2 = hybridShapes7.Item("Verbindung.1109")\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapeAssemble2)\r\n'...
|
||||
'hybridShapeLoft1.AddSectionToLoft reference2, 1, Nothing\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeLoft1\r\n'...
|
||||
'hybridShapeLoft1.Name = "Flaeche mit Mehrfachschnitten.1001"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeLoft1\r\n'...
|
||||
'part1.Update\r\n\r\n'...
|
||||
'Set hybridShapeLoft1 = hybridShapeFactory1.AddNewLoft()\r\n'...
|
||||
'hybridShapeLoft1.SectionCoupling = 1\r\n'...
|
||||
'hybridShapeLoft1.Relimitation = 1\r\n'...
|
||||
'hybridShapeLoft1.CanonicalDetection = 2\r\n'...
|
||||
'Set hybridShapeAssemble1 = hybridShapes7.Item("Verbindung.1105")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromObject(hybridShapeAssemble1)\r\n'...
|
||||
'hybridShapeLoft1.AddSectionToLoft reference1, 1, Nothing\r\n'...
|
||||
'Set hybridShapeAssemble2 = hybridShapes7.Item("Verbindung.1108")\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapeAssemble2)\r\n'...
|
||||
'hybridShapeLoft1.AddSectionToLoft reference2, 1, Nothing\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeLoft1\r\n'...
|
||||
'hybridShapeLoft1.Name = "Flaeche mit Mehrfachschnitten.1002"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeLoft1\r\n'...
|
||||
'part1.Update\r\n\r\n']);
|
||||
% extrapolate shear web
|
||||
fprintf(fileID,[...
|
||||
'Set hybridShapes4 = hybridBody4.HybridShapes\r\n\r\n'...
|
||||
'Set hybridShapeLoft1 = hybridShapes4.Item("Flaeche mit Mehrfachschnitten.1001")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromBRepName("BorderREdge:(BEdge:(Brp:(GSMLoft.88; (Brp:(GSMLine.84))); None:(Limits1:(); Limits2:(); -1); Cf11:()); WithPermanentBody; WithoutBuildError; WithSelectingFeatureSupport; MFBRepVersion_CXR15)", hybridShapeLoft1)\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapeLoft1)\r\n'...
|
||||
'Set hybridShapeExtrapol1 = hybridShapeFactory1.AddNewExtrapolLength(reference1, reference2, 550.000000)\r\n'...
|
||||
'hybridShapeExtrapol1.ContinuityType = 0\r\n'...
|
||||
'hybridShapeExtrapol1.BorderType = 1\r\n'...
|
||||
'hybridShapeExtrapol1.LimitType = 0\r\n'...
|
||||
'hybridShapeExtrapol1.SetAssemble True\r\n'...
|
||||
'hybridShapeExtrapol1.PropagationMode = 2\r\n'...
|
||||
'hybridShapeExtrapol1.ExtendEdgesMode = False\r\n'...
|
||||
'hybridShapeExtrapol1.ConstantLengthMode = False\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeExtrapol1\r\n'...
|
||||
'hybridShapeExtrapol1.Name = "Extrapol.1001"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeExtrapol1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'part1.Update\r\n\r\n'...
|
||||
'Set hybridShapeLoft1 = hybridShapes4.Item("Flaeche mit Mehrfachschnitten.1002")\r\n'...
|
||||
'Set reference1 = part1.CreateReferenceFromBRepName("BorderREdge:(BEdge:(Brp:(GSMLoft.89; (Brp:(GSMLine.83))); None:(Limits1:(); Limits2:(); -1); Cf11:()); WithPermanentBody; WithoutBuildError; WithSelectingFeatureSupport; MFBRepVersion_CXR15)", hybridShapeLoft1)\r\n'...
|
||||
'Set reference2 = part1.CreateReferenceFromObject(hybridShapeLoft1)\r\n'...
|
||||
'Set hybridShapeExtrapol1 = hybridShapeFactory1.AddNewExtrapolLength(reference1, reference2, 550.000000)\r\n'...
|
||||
'hybridShapeExtrapol1.ContinuityType = 0\r\n'...
|
||||
'hybridShapeExtrapol1.BorderType = 1\r\n'...
|
||||
'hybridShapeExtrapol1.LimitType = 0\r\n'...
|
||||
'hybridShapeExtrapol1.SetAssemble True\r\n'...
|
||||
'hybridShapeExtrapol1.PropagationMode = 2\r\n'...
|
||||
'hybridShapeExtrapol1.ExtendEdgesMode = False\r\n'...
|
||||
'hybridShapeExtrapol1.ConstantLengthMode = False\r\n'...
|
||||
'hybridBody4.AppendHybridShape hybridShapeExtrapol1\r\n'...
|
||||
'hybridShapeExtrapol1.Name = "Extrapol.1002"\r\n'...
|
||||
'part1.InWorkObject = hybridShapeExtrapol1\r\n'...
|
||||
'part1.Update\r\n'...
|
||||
'part1.Update\r\n\r\n']);
|
||||
% set "Querschnittsebenen, Abschnittstrennungen, Punkte, Abschnittslinuien"
|
||||
% invisible
|
||||
fprintf(fileID,[...
|
||||
'selection1.Add hybridBody1\r\n'...
|
||||
'selection1.Add hybridBody2\r\n'...
|
||||
'selection1.Add hybridBody6\r\n'...
|
||||
'selection1.Add hybridBody7\r\n'...
|
||||
'Set visPropertySet1 = visPropertySet1.Parent\r\n'...
|
||||
'visPropertySet1.SetShow 1\r\n']);
|
||||
% end of file
|
||||
fprintf(fileID,[...
|
||||
'selection1.Clear\r\n'...
|
||||
'CATIA.RefreshDisplay = True\r\n\r\n'...
|
||||
'End Sub\r\n']);
|
||||
fclose(fileID);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user