Skip to content

Instantly share code, notes, and snippets.

@takashiski
Created November 24, 2019 15:48
Show Gist options
  • Save takashiski/9cd50f953b5e90071d78970348f74585 to your computer and use it in GitHub Desktop.
Save takashiski/9cd50f953b5e90071d78970348f74585 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Corel.Interop.VGCore;
namespace VSTAGlobal
{
public partial class Main
{
private void Startup()
{
}
[CgsAddInMacro]
public void Macro1()
{
float unitWidth = 3/16f;
float unitHeight = 1 / 20f;
int switchNum = 5;
int num = 4 * switchNum + 1;
//preprocess();
for (float i = 4; i < num; i += 1)
{
Shape rect= app.ActiveLayer.CreateRectangle2(
0, i*unitHeight,
unitWidth*i,i!=num-1?unitHeight:unitWidth*4);
rect.Outline.Color.RGBAssign(255, 0, 0);
}
for(float i=4;i<num;i+=1)
{
Shape line = app.ActiveLayer.CreateLineSegment(
unitWidth * i, unitHeight * i,
unitWidth * i, i%4!=0?unitHeight * (i-2):unitHeight
);
line.Outline.Color.RGBAssign(0, 0, 0);
}
postprocess();
}
private void preprocess()
{
app.Optimization = true;
}
private void postprocess()
{
app.Optimization = false;
app.Refresh();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment