1. Home
  2. /
  3. Solidworks-api
  4. /
  5. Create a Circular Pattern

Create a Circular Pattern - Solidworks-api Typing CST Test

Loading…

Create a Circular Pattern — Solidworks-api Code

Creates a circular pattern of a feature around an axis.

swPart.Extension.SelectByID2 "Boss-Extrude1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0
swPart.Extension.SelectByID2 "Axis1", "AXIS", 0, 0, 0, True, 0, Nothing, 0
swPart.FeatureManager.FeatureCircularPattern3 6, 360, False, True, True, True, False, 0, 0, False

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.

Quick Explain

  • ▸Provides programmatic access to SolidWorks objects, documents, and features.
  • ▸Supports automation of repetitive modeling tasks and drawing creation.
  • ▸Allows integration with databases, PLM, and ERP systems.
  • ▸Enables creation of custom add-ins, macros, and tools for engineers and designers.
  • ▸Uses languages such as VBA, VB.NET, C#, and C++ through COM interop.

Core Features

  • ▸Automation of sketching, features, assemblies, and drawings
  • ▸Property and configuration management
  • ▸Custom property and document manipulation
  • ▸Interaction with SolidWorks events (e.g., file open, rebuild)
  • ▸Support for both VBA macros and .NET add-ins

Learning Path

  • ▸Learn SolidWorks fundamentals
  • ▸Understand VBA or .NET programming
  • ▸Explore SolidWorks object model
  • ▸Develop simple macros
  • ▸Advance to add-in development and external integrations

Practical Examples

  • ▸Automatically generate part drawings with title blocks
  • ▸Create assembly configurations programmatically
  • ▸Export BOMs to Excel or database
  • ▸Custom feature creation based on design rules
  • ▸Batch processing of files for standardization

Comparisons

  • ▸SolidWorks API vs Inventor API: both COM-based, SolidWorks uses SW object model, Inventor has Inventor-specific events
  • ▸SolidWorks API vs Fusion 360 API: Fusion is cloud-based Python/JavaScript, SolidWorks is Windows COM/.NET
  • ▸Macro vs Add-in: macros are simpler scripts, add-ins are compiled for deployment and events
  • ▸SolidWorks API vs AutoCAD API: SolidWorks API more feature-tree focused, AutoCAD API drawing-object oriented
  • ▸SolidWorks API vs OpenCASCADE: OpenCASCADE is geometry kernel; SW API automates SolidWorks

Strengths

  • ▸Reduces repetitive manual CAD operations
  • ▸Enables company-specific design rules and standards
  • ▸Improves design productivity and consistency
  • ▸Integrates seamlessly with existing SolidWorks environment
  • ▸Supports complex workflows for large assemblies

Limitations

  • ▸Requires knowledge of COM and SolidWorks object model
  • ▸Performance can be limited for very large assemblies
  • ▸Learning curve for VBA/.NET or C# integration
  • ▸Limited cross-platform support (Windows only)
  • ▸API changes between SolidWorks versions can affect macros/add-ins

When NOT to Use

  • ▸Small one-off manual edits not worth automation
  • ▸Non-Windows environments
  • ▸Cloud-only workflows outside SolidWorks
  • ▸Highly graphical manipulations not supported via API
  • ▸Projects where manual designer decision is needed for each feature

Cheat Sheet

  • ▸swApp -> main SolidWorks application object
  • ▸PartDoc, AssemblyDoc, DrawingDoc -> document types
  • ▸Feature -> a modeling operation
  • ▸Configuration -> variant of part or assembly
  • ▸CustomPropertyManager -> access custom properties

FAQ

  • ▸Can I use SolidWorks API on Mac? -> No, Windows only.
  • ▸Which languages are supported? -> VBA, VB.NET, C#, C++ (COM interop).
  • ▸Can API create new drawings? -> Yes, fully automatable.
  • ▸Is macro recorder sufficient for complex automation? -> Only for simple tasks; add-ins needed for complex workflows.
  • ▸Does API support assemblies and configurations? -> Yes, full support via object model.

30-Day Skill Plan

  • ▸Week 1: Simple macros for part and drawing properties
  • ▸Week 2: Automate assembly operations
  • ▸Week 3: Event handling and feature automation
  • ▸Week 4: Add-in development with C# or VB.NET
  • ▸Week 5: Integrate with Excel, databases, and PLM systems

Final Summary

  • ▸SolidWorks API enables automation, customization, and integration of CAD workflows.
  • ▸Supports macros for simple automation and add-ins for complex tasks.
  • ▸Uses COM-based object model and supports VBA, .NET languages, and C++.
  • ▸Integrates with PLM/ERP, databases, and external systems.
  • ▸Widely used in manufacturing, mechanical design, and engineering automation.

Project Structure

  • ▸Macro files (.swp, .sldmacro) or .NET add-in projects
  • ▸References to SolidWorks.Interop assemblies
  • ▸Configuration files for custom tools
  • ▸Unit tests for automation scripts
  • ▸Documentation of API usage and custom workflows

Monetization

  • ▸Custom SolidWorks add-in development services
  • ▸Engineering automation consulting
  • ▸PLM/ERP integration solutions
  • ▸Macros and templates for enterprise use
  • ▸Training engineers in API usage and automation

Productivity Tips

  • ▸Start with macro recorder to learn API calls
  • ▸Use Visual Studio for robust add-in development
  • ▸Organize API code into reusable modules
  • ▸Batch process repetitive tasks
  • ▸Document all automation scripts and add-ins

Basic Concepts

  • ▸COM Automation - core communication protocol with SolidWorks
  • ▸Document types - Part, Assembly, Drawing
  • ▸Features - extrude, cut, fillet, etc.
  • ▸Sketches - 2D drawings used to create features
  • ▸Configurations - variations of parts or assemblies

Official Docs

  • ▸https://help.solidworks.com
  • ▸https://solidworks.com/developer/api

More Solidworks-api Typing Exercises

Create a New Part DocumentAdd a Sketch on Front PlaneDraw a Line in SketchDraw a Circle in SketchExtrude a SketchCreate a Rectangle SketchApply Fillet to EdgeAdd Material to PartSave Part Document

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher