CST Macros Code to MATLAB Code
22 次查看(过去 30 天)
显示 更早的评论
Hlw I am wring a code in matlab where I am interfacing CST using MATLAB code.For this I have to write individual function in MATLAB from CST VBA Macros code.
This is a code for extrude in CST
Sub Main ()
'## Merged Block - define extrude: component1:solid1
StartVersionStringOverrideMode "2022.3|31.0.1|20220204"
With Extrude
.Reset
.Name "solid1"
.Component "component1"
.Material "PEC"
.Mode "Pointlist"
.Height "1"
.Twist "0.0"
.Taper "0.0"
.Origin "0.0", "0.0", "2"
.Uvector "1.0", "0.0", "0.0"
.Vvector "0.0", "1.0", "0.0"
.Point "6", "1"
.LineTo "5", "1"
.LineTo "5", "2"
.Create
End With
StopVersionStringOverrideMode
End Sub .From this I have written the following MATLAB Code for extrude function
function Cstextrude(mws, Name, component, material, Mode, Height, Twist, Taper, Origin, Uvector, Vvector, Points)
invoke(extrude, 'Reset');
invoke(extrude, 'Name', Name);
invoke(extrude, 'Component', component);
invoke(extrude, 'Material', material);
invoke(extrude, 'Mode', Mode);
invoke(extrude, 'Height', Height);
invoke(extrude, 'Twist', Twist);
invoke(extrude, 'Taper', Taper);
invoke(extrude,'Origin', num2str(Origin(1)), num2str(Origin(2)), num2str(Origin(3)));
invoke(extrude,'Uvector', num2str(Uvector(1)), num2str(Uvector(2)), num2str(Uvector(3)));
invoke(extrude,'Vvector', num2str(Vvector(1)), num2str(Vvector(2)), num2str(Vvector(3)));
for i = 1:size(Points, 1)
point = Points(i, :);
X_point = point{1};
Y_point = point{2};
invoke(extrude, 'LineTo', X_point, Y_point);
end
invoke(extrude, 'Create');
release(extrude);
end
But I am not getting exact shape from this code and I think for i = 1:size(Points, 1)
point = Points(i, :);
X_point = point{1};
Y_point = point{2};
invoke(extrude, 'LineTo', X_point, Y_point);
end this part might be not showing what
Point "6", "1"
.LineTo "5", "1"
.LineTo "5", "2" this part is doing in vba macros in cst.
Can anyone please tell me
for i = 1:size(Points, 1)
point = Points(i, :);
X_point = point{1};
Y_point = point{2};
invoke(extrude, 'LineTo', X_point, Y_point); is this part is correct?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!