Every STD library function in powermill.

Every STD library function in powermill.

MitchPflederer
Advocate Advocate
115 Views
3 Replies
Message 1 of 4

Every STD library function in powermill.

MitchPflederer
Advocate
Advocate

## COMPLETE FUNCTION REFERENCE (Organized by Category)

---

##  **MATHEMATICAL & TRIGONOMETRIC FUNCTIONS** (16 functions)

abs - Absolute (positive value).
acos - Trigonometric arccosine.
angle - Get unsigned angle between two vectors.
apparent_angle - Given a reference vector, get signed angle between two vectors.
asin - Trigonometric arcsine.
atan - Trigonometric arctangent.
atan2 - Trigonometric arctangent with quadrant determination.
azimuth - Get Azimuth from vector
compare - Compare the equality of two values to a tolerance.
distance - distance(pt1, pt2) : distance between two points.
elevation - Get Elevation from vector
equiv - equiv(val1, val2, tolerance) : Compare the equality of two values to a tolerance.
ln - Natural (base e) logarithm.
log - Base 10 logarithm.
normal - Get normal vector from three points.
parallel - parallel(vec1, vec2, tolerance) : Returns true if vectors are parallel.
round - Round to nearest integer.
sin - Trigonometric sine.
sqrt - Square root.
tan - Trigonometric tangent.

---

## **STRING MANIPULATION FUNCTIONS** (15 functions)

basename - Strip directory from filepath strings.
contains_string - contains_string(str, sub) : Determines if 'str' contains the substring 'sub'.
dirname - Extract directory from filepath strings.
float_format - float_format(val, precision) : Format a floating point number.
format_number - format_number(val, digits, grouping) : Format a number.
format_time - format_time(seconds, precision) : Format time.
join - join(list, separator) : Join list elements into a single string.
lcase - lcase(str) : Convert string to lower case.
ltrim - ltrim(str) : Remove whitespace from start of string.
replace - replace(str, old, new) : Replace substrings.
rtrim - rtrim(str) : Remove whitespace from end of string.
str_replace - str_replace(str, old, new) : Replace substrings.
time_string - time_string(seconds) : Convert seconds to time string.
time_to_string - time_to_string(seconds) : Convert seconds to time string.
tokens - tokens(str) : Returns a list of delimited tokens str.
trim - trim(str) : Remove whitespace from both ends of string.
ucase - ucase(str) : Convert string to upper case.

---

## **LIST & COLLECTION OPERATIONS** (24 functions)

add_first - add_first(list, item) : Add item into start of list.
add_last - add_last(list, item) : Add item onto end of list.
apply - apply(list, expression) : Returns a list of results obtained by applying expression to each element in the i
list
concatenate - concatenate(list1, list2) : Add list2 onto the end of list1.
contains - contains(container, item) : Returns true if item is present in the container.
extract - extract(list, expression) : Extract data from a list.
filter - filter(list, condition) : Filter data from a list.
flatten - flatten(list) : Return a flattened version of the list.
intersection - intersection(list1, list2) : Returns a list containing values that are in both lists.
is_empty - is_empty(list) : Returns true if the list is empty.
key_first - key_first(map) : get the first key from the map
max - max(list) : Return maximum value from list.
mean - mean(list) : Return mean value from list.
member - member(list, item) : Returns true if item is a member of the list.
min - min(list) : Return minimum value from list.
remove - remove(list, item) : Remove item from list.
remove_duplicates - remove_duplicates(list) : Remove duplicate entries from list.
remove_first - remove_first(list) : Remove and return first item from list.
remove_last - remove_last(list) : Remove and return last item from list.
reverse - reverse(list) : Reverse a list.
size - size(list) : Get the number of items in the list.
slice - slice(list, start, end) : Get a slice of a list.
sort - sort(list) : Sort a list.
sum - sum(list) : Return sum of values in list.

---

## **TYPE CONVERSION FUNCTIONS** (8 functions)

bool - Convert to boolean value.
dec_to_bin - Convert from decimal to binary representation.
dec_to_hex - Convert from decimal to hexadecimal representation.
hex_to_dec - Convert from hexadecimal to decimal representation.
int - Convert to integer value.
real - Convert to real value.
str - Convert to string value.
type - type(obj) : Get type of object.

---

## **ENTITY MANAGEMENT FUNCTIONS** (35 functions)

activate_entity - Make an entity the active one of its type
add_entity - Add an entity to a group or setup
calculate_entity - Calculate entity given a type-name and <name>
clone_entity - Clone a toolpath or boundary
count_entity_type - Count of entities of given entity type
create_boundary_level_from_string - Create boundary level. You specify the level by name
create_line_entity - Create a line entity from two points
create_ncprogram - Create a nc program in the project
create_ncsetup - Create a nc setup in the project
create_point_entity - Create point entity from coordinates
create_polygon_entity - Create a polygon entity from a list of points
create_sequence - Create a new sequence of existing entities
create_toolaxis_level_from_string - Create toolaxis level. You specify the level by name
create_toolpath - Create a toolpath
delete_entity - Delete an entity
delete_ncprogram - Delete NC program by name
delete_ncsetup - Delete NC setup by name
delete_sequence - Delete sequence by name
downcast - downcast(entity) : downcast an entity to its implementation type
ensure_entity_calculated - Ensure that an entity is calculated. Return 1 if successful, 0 otherwise.
entitiy_from_name - Find entity with specified name, of specified type.
entities_equivalent - Check whether two entities are equivalent.
entity_dependency_changed - Entity Dependency Changed
entity_exists - entity_exists(entity) : Returns true if the specified entity exists.
entity_modified - entity_modified(entity, recursive) : Returns true if the entity has been modified since last
calculated.
entity_tooltip - Return the tooltip string for entity
entity_tree_node - Get tree node for entity
entity_tree_nodes - Get tree nodes for entity type
entity_visible - entity_visible(entity) : Returns true if the specified entity is currently visible.
export_entity - Export Entity
find_entity - Find an entity in the project
frozen - frozen(entity) : Returns true if the specified entity is frozen.
invalidate_entity - Mark an entity as requiring calculation
length - length(entity) : Length of an entity.
locked - locked(entity) : Returns true if the specified entity is locked.
lockers - lockers(entity) : Return list of entities locking this entity
new_entity_name - Generate a new entity name
next_in_sequence - Get next entity in sequence
pathname - pathname(entity) : Return full pathname of entity.
position - position(entity) : Get position vector of entity.
rename_entity - Rename an entity
search_entity - Search for entity by name
select_entity - Select an entity
sequenced_entity - Get sequenced entity
sequenced_entities - Get all sequenced entities
set_entity_position_in_folder - Set the position of an entity in its folder
trunk - trunk(entity) : Trunk this entity
unique_entity_type - Get unique entity type for entity
valid_entity - valid_entity(entity) : Returns true if the specified entity is valid.

---

## **TOOLPATH ANALYSIS & MANIPULATION** (45 functions)

boundary_entirely_contains_toolpath - Find whether a closed boundary entirely contains the toolpath, when looking do
given view.
boundary_segment_count - Get the number of segments in a boundary
check_multiaxis - Returns true if given toolpath is multiaxis
check_normals - Returns true if given toolpath has normals
check_order - Checks segment closest to point (x1,y1,z1) is in a segment ordered before segment closest to point (x2
z2).
check_rest_finishing_toolpath - Test the reliability of the rest finishing toolpath
check_tool_axis - Check tool axis
check_tool_orientation - Check tool axis
check_toolpath_start_point_block - Check the toolpath start point against the block.
closest_point_in_layer - Returns a map describing the toolpath point within the specified layer that is closest to t
specified point
closest_point_on_toolpath - Find the point on the toolpath which is closest to the given one.
component_get_colliding_section - Retrieve information about a colliding section of a toolpath component
component_get_length - Get the length of a toolpath component
component_has_point_parameter - Return value indicates whether the named point parameter is present on at least one
point of the specified toolpath component.
component_list_distance_along - Get the list of distances along a toolpath component at which the named point parame
changes value
component_parameters_names - Get the list of named point parameters associated with the toolpath component.
component_remove_point_parameter - Remove named point parameter from all points of the toolpath component.
component_segment_midpoint - Find the point at the centre of the given segment of the given component.
components - components(entity) : get a list of the components for a toolpath or area clearance stock.
current_region - The name of the currently selected curve/region for the active toolpath
first_segment_feed_rate - Get the feed rate of the first segment of a toolpath
get_toolpath_block_extents - Get the extents of the toolpath as clipped by the block
get_toolpath_extents - Get the extents of the toolpath
group_toolpaths_by_workplanes - Return map from workplane names to lists of toolpaths in those workplanes.
is_toolpath_empty - is_toolpath_empty(entity) : Returns true if the specified toolpath is empty
num_toolpath_segments_inside_boundary - Get the number of toolpath segments that are inside the boundary
num_toolpath_segments_outside_boundary - Get the number of toolpath segments that are outside the boundary
num_tp_segments_inside_2d_box - Get the number of toolpath segments inside a 2d bounding box
num_tp_segments_inside_box - Get the number of toolpath segments inside a bounding box
num_tp_segments_outside_2d_box - Get the number of toolpath segments outside a 2d bounding box
number_toolpath_components - Get the number of components for the toolpath
point_add_parameter - Add named point parameter to toolpath component point.
point_parameters - Get the list of named point parameters associated with the toolpath component point.
point_remove_parameter - Remove named point parameter from toolpath component point.
point_remove_parameters - Remove all named point parameters from toolpath component point.
segment_get_length - Get the length of a toolpath segment
segment_has_leadin - Checks whether the specified segment is preceded by a lead in
segment_has_leadout - Checks whether the specified segment is followed by a lead out
segments - segments(entity) : get the number of segments for a toolpath.
segments_inside_boundary - Get toolpath segments that are inside the boundary
segments_outside_boundary - Get toolpath segments that are outside the boundary
toolpath_components_inside_boundary - Get toolpath components that are inside the boundary
toolpath_components_outside_boundary - Get toolpath components that are outside the boundary
toolpath_extents - toolpath_extents(entity) : Get the extents of the toolpath.
toolpath_parameters - Get toolpath parameters
toolpath_rapid_feed_rate - Get rapid feed rate of toolpath
toolpaths_in_workplane - toolpaths_in_workplane(workplane) : Return list of toolpaths in given workplane.
toolpaths_workplane - toolpaths_workplane(toolpath) : Return workplane of toolpath.
tp_has_check_multiaxis - Check if toolpath has check multiaxis enabled
tp_has_check_normals - Check if toolpath has check normals enabled
tp_has_check_tool_axis - Check if toolpath has check tool axis enabled
tp_has_check_tool_orientation - Check if toolpath has check tool orientation enabled
valid_toolpath_start_point_block - Validate toolpath start point against block.

---

## **COLLISION DETECTION & SAFETY** (15 functions)

collisions_between - Collisions between
collisions_involving - Collisions involving
detect_holder_collisions - Detect holder collisions for the active toolpath.
detect_holder_near_misses - Detect holder near misses for the active toolpath.
detect_leadinout_collisions - Detect leadinout collisions for the active toolpath.
detect_leadinout_near_misses - Detect leadinout near misses for the active toolpath.
detect_shank_collisions - Detect shank collisions for the active toolpath.
detect_shank_near_misses - Detect shank near misses for the active toolpath.
detect_tool_collisions - Detect tool collisions for the active toolpath.
detect_tool_near_misses - Detect tool near misses for the active toolpath.
reset_holder_safety_status - Reset holder safety status for the active toolpath.
reset_safe_areas - Reset safe areas
reset_toolpath_safety_status - Reset toolpath safety status for the active toolpath.
user_wants_fast_compute - Check if user wants fast compute
wait_entity_calculation_finished - Wait for entity calculation to finish

---

## **MACHINE & COORDINATE OPERATIONS** (12 functions)

machine - machine(entity) : Get a map of the current machine coordinates for a given point.
machine_axis - machine_axis(name) : get the machine axis
machine_head_coordinates - Get the machine head coordinates
machine_table_coordinates - Get the machine table coordinates
point_to_work - point_to_work(point) : Transform a point from world coordinates to workplane coordinates.
point_to_world - point_to_world(point) : Transform a point from workplane coordinates to world coordinates.
robot_has_posture - Test if robot has posture
robot_linear_axis_position - Get robot linear axis position
robot_linear_axis_position_check - Check robot linear axis position
robot_rotary_axis_position - Get robot rotary axis position
robot_rotary_axis_position_check - Check robot rotary axis position
same_workplane - same_workplane(entity1, entity2) : Check if entities are on same workplane.

---

## **TIME & PERFORMANCE MONITORING** (12 functions)

cycle_time - Time taken to compute the active toolpath
get_machining_time - Get the estimated machining time for the specified entity.
get_rapid_time - Get rapid time
get_segmentation_time - Get segmentation time
get_verification_time - Get verification time
local_time - Get local time
max_cutting_toolaxis_elevation_change_degrees - Maximum cutting toolaxis elevation change in degrees
max_cutting_toolaxis_elevation_degrees - Maximum cutting toolaxis elevation in degrees
min_cutting_toolaxis_elevation_degrees - Minimum cutting toolaxis elevation in degrees
orientation_vector_direction - Get orientation vector direction
tkfactor - Get current tkfactor
wait - wait(seconds) : Wait for specified time.

---

## **PROJECT & WORKSPACE MANAGEMENT** (20 functions)

active_folder - Get the active folder for an entity type.
default_file_path - Gets the default file path.
folder - folder(entity_type) : returns a list of entities of the given type
folder_path - Get folder path for entity
has_setup - Check if the entity has a setup
macro_path - macro_path(level) : Returns the path of the calling macro.
nc_setup - Get nc setup for entity
parent - parent(entity) : Return the parent of an entity
parent_setup - Get parent setup for entity
path_join - path_join(path, ...) : Join path elements.
path_safe_to_resolve - path_safe_to_resolve(path) : Returns true if resolving path is safe.
project_locked - project_locked() : Returns true if the project is locked.
project_modified - project_modified() : Returns true if the project is modified.
project_pathname - project_pathname(level) : Get project path.
project_readonly - project_readonly() : Returns true if the project is read only.
pwd - pwd() : Get current working directory.
read_session - read_session(filename) : Read session data from a file.
setup_exists - Check if setup exists
workplane_rel_limits - workplane_rel_limits(entity) : Get workplane-relative limits of entity.
limits_workplane_rel - limits_workplane_rel(entity) : Get workplane-relative limits of entity.

---

## **FILE & SYSTEM OPERATIONS** (14 functions)

dir_exists - dir_exists(dirname) : Returns true if the specified directory exists.
empty_directory - empty_directory(dirname) : Returns true if the specified directory is empty.
file_exists - file_exists(filename) : Returns true if the specified file exists.
list_files - Get list of files
recent_files - Get list of recent files
unzip - unzip(zipfile, destination) : Unzip a file.
zip - zip(file1, file2) : Create zip file.
zip_files - zip_files(filelist, destination) : Create zip file from list of files.
download_from_cloud - Download data from autodesk drive and return as string.
upload_to_cloud - Upload data to autodesk drive.
memory_state - Get memory state
is_debug_build - Test if this is a debug build
is_release_build - Test if this is a release build
on_mac - Test if running on a mac

---

## **USER INTERFACE & INTERACTION** (12 functions)

checked_list_rows - Get an array containing the checked status of each row in a list widget
list_cell_value - Get the value from the specified row and column of a list widget
list_num_rows - Get the number of rows in a list widget
number_selected - Get number of selected entities of given type
ribbon_active_tab - Get the name of the active ribbon tab
unchecked_list_rows - Get an array containing the unchecked row indices in a list widget
block_drawn - Is the block currently drawn?
help - help() : Get textual description of the help.
if - if(condition, then_value, else_value) : Conditional expression.
issecurity - Check security status
reset_all_preview - Reset all entity preview to none
string_test - Perform string test

---

## **TOOL & COMPONENT MANAGEMENT** (15 functions)

add_holder_component - Add holder component to tool
add_shank_component - Add shank component to tool
count_nctoolpaths - Get count of NC toolpaths in setup
get_default_tool_overhang - Get the tool overhang value
list_nctools - Get list of NC tools for setup
nctoolpath_fixtureoffset - Get fixture offset for nc toolpath
number_nctoolpaths - Get number of NC toolpaths in setup
number_nctools - Get number of NC tools for setup
cut_value - Cut percentage value
port_machining - Returns whether port machining is enabled
subnc_name - Get subnc name
subnc_workplanes - Get subnc workplanes
add_line_to_pattern - Create a line pattern from two points
make_sequence - Make a sequence
map_key - map_key(name, ...) : Build a hierarchical key string.

---

## **GEOMETRY & MEASUREMENT** (18 functions)

add_all_surfaces_to_level - Add all surfaces to level
add_all_walls_to_level - Add all surfaces to level
add_level_to_thickness_slot - Add the components in the level/set to a thickness slot
add_surface_to_level - Add named surface to level
clamp_level - Set or unset a clamp level
copy_thickness_sets - Update the thickness slot parameters
delete_level_from_thickness_slot - Remove the thickness slot with the specified name
extract_thickness_from_string - Extract the distance value from the thickness string
get_thickness_distance - Get the distance value from the thickness string
get_thickness_thicknessset - Get the thickness set name from the thickness string
level_entity - Return 1 if the type of the level is 'level'
limits - limits(entity) : Get world limits of entity.
model_components_thicknessset - Get the components for the thickness set
number_of_components_in_layer - Get the number of components for the layer
thickness_slots - Get thickness slots
update_thickness_slot_for_toolpath - Update the thickness slot
update_toolpath_level_for_model - Update the toolpath level for the model
model_tree_node - Get tree node for model
model_tree_nodes - Get tree nodes for model

---

## **ADVANCED FEATURES & TESTING** (20 functions)

active - Returns true if the parameter is active.
available_preview_levels - Get a list of the available preview levels.
check_degouging_filter - Test that the degouging filter is working as expected
check_perimeter_calculation - Test surface perimeter calculation is working as expected
clear_area_clearance_cache - Clear the cache used by area clearance
clear_breaks - Remove all progress break simulation points set by set_break().
clear_inclined_flats_cache - Clear the cache used by inclined flats
desc - desc(obj) : Get textual description of the object.
edit_undo - Performs an edit undo
get_break_point - Get the point on which the break was set during simulation.
get_param - Get parameter value
installed_plugins - Get list of installed plugins
issues_of_type - Issues of type
key_remainder - key_remainder(key) : Returns the remainder part of a key
pmill_version - Get PowerMill version
reset_block - Reset the block
reset_debug_toolpaths - Reset debug toolpath list
set_param - Set parameter value
set_status - Set status
suppressing_prerelease_preview_levels - Create a job instruction and return its data.
value_list - Get value list
version - Get version

0 Likes
116 Views
3 Replies
Replies (3)
Message 2 of 4

icse
Collaborator
Collaborator

some functions are missing eg:

string substring(string input, int startindex, int length) and its overload substring(string input, int startindex) etc

 

also how do those work?:

dec_to_bin - Convert from decimal to binary representation.
dec_to_hex - Convert from decimal to hexadecimal representation.
hex_to_dec - Convert from hexadecimal to decimal representation.

 

i cant get them to work also never saw em 😛

0 Likes
Message 3 of 4

Sean571
Advocate
Advocate

This is just a print out of the PowerMill standard library using a macro, so a lot of these functions aren't documented and you have to just play around and guess at what the function arguments are. And some very well might not have any use for the end user, but it's fun to play around with them. So you just have to test out as many ways to use a function as possible until you land on something that works.

Sean Wroblewski
Applications Engineer

0 Likes
Message 4 of 4

artur.boszczyk
Advocate
Advocate

I wish all of these were documented, with links to each one. Examples would also be helpful. That would make it a valuable resource. As it stands now, it’s just not useful at all.

0 Likes