Hide Table of Contents

Defining Custom Segment Types

You can define custom segment types before creating segment-based motor, torque, or force profiles in the Function Builder.

  1. Create a text file called SegmentTypes.txt.
  2. Define segments types according to the segment type syntax.
  3. Specify the segment types file location:
    1. Click Options (Standard toolbar) and select File Locations.
    2. Under Show folders for, select Function Builder Segment Type Definitions.
    3. Click Add, browse to the folder containing SegmentTypes.txt, and click OK twice.
    The custom segment type functions you define appear in the Function Builder followed by the tag User.

Segment Type Syntax

The segment types you can select from the Function Builder are functions of the independent variable. You can piece together the segment type functions to define a piecewise continuous motor or force profile.

Each segment type you select defines the profile function on a continuous range of independent variable values. You can create custom Function Builder segment types in a file named SegmentTypes.txt. You can define a segment type function with basic programming commands within the segment type syntax.

To use custom segment types, you must point to the folder containing the SegmentTypes.txt file from File Locations in the System Options dialog box.


Begin each segment type definition with SegmentType("Type_Name", independent_variable, param_2, … param_n) and end each segment type definition with the command endSegmentType. You must include a return statement within the definition. Use mathematical operators to define the segment type function between these two commands.

Commands and Variables Description
SegmentType("Type_Name", independent_variable, arg2, … argn) Begins the segment type function definition.
"Type_Name" String variable in quotes specifying a unique name for the segment type function.
independent_variable Variable representing the function independent variable.
param_2, … param_n Variables representing any number of parameters you require to define the function.
The number of required parameters depends on the function you define.
return Returns the segment type function value computed from the input arguments.
endSegmentType Ends the segment type function definition.
' Comment.

Cubic Segment Type Example

'------------- Cubic -------------------
SegmentType("Cubic", x, x1, y1, x2, y2)
     xbar = (x-x1)/(x2-x1);
     ybar = 3*xbar^2-2*xbar^3;
     y = y1+(y2-y1)*ybar;
     return y;

See Default Segment Type Function Definitions for more segment type function definitions.

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   Defining Custom Segment Types
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: SOLIDWORKS 2016 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.