1. Home
  2. /
  3. Solidworks-api
  4. /
  5. Create a Rectangle Sketch

Create a Rectangle Sketch - Solidworks-api Typing CST Test

Loading…

Create a Rectangle Sketch — Solidworks-api Code

Draws a rectangle using four lines in a sketch.

Dim p1, p2, p3, p4 As SketchSegment
Set p1 = swSketchMgr.CreateLine(0, 0, 0, 0.1, 0, 0)
Set p2 = swSketchMgr.CreateLine(0.1, 0, 0, 0.1, 0.05, 0)
Set p3 = swSketchMgr.CreateLine(0.1, 0.05, 0, 0, 0.05, 0)
Set p4 = swSketchMgr.CreateLine(0, 0.05, 0, 0, 0, 0)

Solidworks-api Language Guide

SolidWorks API is a COM-based programming interface that allows developers to automate, customize, and extend the SolidWorks CAD software, enabling tasks from simple macros to complex design automation and integration with external systems.

Primary Use Cases

  • ▸Automate repetitive modeling or drawing tasks
  • ▸Create custom add-ins for design processes
  • ▸Integrate SolidWorks with PLM/ERP databases
  • ▸Generate reports and BOMs automatically
  • ▸Custom tools for design validation and rule enforcement

Notable Features

  • ▸COM-based automation interface
  • ▸Supports macros and standalone add-ins
  • ▸Access to all SolidWorks document types (parts, assemblies, drawings)
  • ▸Event handling for real-time customization
  • ▸Extensive object model reflecting SolidWorks entities

Origin & Creator

Developed by Dassault Systèmes, with API support introduced alongside SolidWorks to enable customization and automation.

Industrial Note

Widely used in manufacturing, mechanical design, product lifecycle management, and custom engineering workflows to reduce design time and enforce company-specific standards.

More Solidworks-api Typing Exercises

Create a New Part DocumentAdd a Sketch on Front PlaneDraw a Line in SketchDraw a Circle in SketchExtrude a SketchApply Fillet to EdgeAdd Material to PartCreate a Circular PatternSave Part Document

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher