Hi Mashrur Zawad,
As per my understanding, you are trying to write a MATLAB function from CST VBA Macro code.
In your CST VBA macro code, you define a point and then draw lines to create the shape:
.Point "6", "1"
.LineTo "5", "1"
.LineTo "5", "2"
In your MATLAB function, follow the same process i.e., set the initial point using the "Point" method and draw lines using the "LineTo" method from that initial point to other points.
Refer to the following updated MATLAB function:
function Cstextrude(mws, Name, component, material, Mode, Height, Twist, Taper, Origin, Uvector, Vvector, Points)
extrude = invoke(mws, 'Extrude');
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)));
% Set the initial point
initialPoint = Points(1, :);
invoke(extrude, 'Point', num2str(initialPoint(1)), num2str(initialPoint(2)));
% Use LineTo for remaining points
for i = 2:size(Points, 1)
point = Points(i, :);
X_point = num2str(point(1));
Y_point = num2str(point(2));
invoke(extrude, 'LineTo', X_point, Y_point);
end
invoke(extrude, 'Create');
release(extrude);
end
Hope this helps!