精简版Circle

精简版Circle

using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Circle
{
    public partial class Form1 : Form
    {
        private SldWorks swApp;
        private string stDefaultTemplatePart;
        private ModelDoc2 swModel;
        private ModelView swModelView;
        private ModelDocExtension swModelEx;
        private FeatureManager swFeatMgr;

        public Form1()
        {
            InitializeComponent();
        }

        private void bt_generate_Click(object sender, EventArgs e)
        {
            double length = Convert.ToDouble(tb_length.Text);
            double width = Convert.ToDouble(tb_width.Text);
            double high = Convert.ToDouble(tb_high.Text);



            ConnectSw();

            NewPart();

            FrameMax();

            //单位转换, mm to m

            length /= 1000;

            width /= 1000;

            high /= 1000;

            //选择基准面

            swModelEx = swModel.Extension;

            swModelEx.SelectByID2("上视基准面", "PLANE", 0, 0, 0, false, 0, null, 0);

            //新建草图

            SketchManager swSketchMgr = swModel.SketchManager;

            swSketchMgr.InsertSketch(true);

            swSketchMgr.CreateCornerRectangle(0, 0, 0, length, width, 0);

            swSketchMgr.InsertSketch(true);

            //视角

            ViewShow("等轴测");

            //拉伸

            swModelEx.SelectByID2("草图1&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值