8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 1/30
SpaceClaim Developers Guide
SpaceClaim Developers Guide
API V9 Final
Last updated: March 7 !"#!
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 2/30
SpaceClaim Developers Guide
Table of Contents
1 Introduction...................................................................................................................................................4
#)# Purpose))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))*
#)! Pro%rammin% Lan%ua%e)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))*
#)+ Conventions)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))*
2 Overview........................................................................................................................................................5
!)# Architecture))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))),
!)! Doc -./ects))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))0
!)+ Document Structure)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) 0
!)* Part Structure))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))7
!), Dra1in% Sheet Structure))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))9
3 Documents and Doc Objects........................................................................................................................11
+)# -vervie1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))##
+)! Parent(Child 2ierarch$)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))##
+)+ Parts and Components))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))#!
+)* Instances and -ccurrences)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) #+
+), -ccurrence Chains)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))#*
+)0 General -./ects and Masters))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))#*
+)7 -ri%inals and Masters))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))#*
+)' 3rans4ormin% to Master(Space)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) #*
+)9 Gettin% -ccurrences))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))#,4 Application Integration................................................................................................................................16
*)# Persistent Identi4iers))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))#0
*)! 5eplacements)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) #0
*)+ 6pdate States)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))#7
5 toring !ustom Data....................................................................................................................................1"
,)# Document Properties)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))#'
,)! Custom Attri.utes))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))#'
,)+ Attri.ute Propa%ation))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))#9
6 Identi#$ing Objects in A!I and %arasolid &iles.............................................................................................2'
0)# Identi4iers Durin% 8port))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!"
0)! Forei%n Identi4iers Durin% Import and 8port))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!"
( )eometr$ and *opolog$...............................................................................................................................21
7)# 6n.ounded Geometr$ and 3rimmed -./ects))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!#
7)! 3opolo%$))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!#
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 3/30
SpaceClaim Developers Guide
7)+ Doc -./ects and Geometr$))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!!
7)* Desi%n Curves))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))!!
7), Desi%n odies)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) !+
7)0 Shape in General))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!*
" Accurac$.......................................................................................................................................................25
')# Linear and An%ular 5esolution)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!,
')! Comparin% Len%ths and An%les))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!,
')+ Comparin% ;< -./ects))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!0
')* Comparin% 6V -./ects)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!0
'), Comparin% Geometr$))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))!0
+ ,nits.............................................................................................................................................................2(
9)# S$stem 6nits and 6ser 6nits))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!7
9)! -utputtin% Values))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!7
9)+ Inputtin% Values)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!7
9)* Custom Conversions))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))!7
1' !alling *-e A%I &rom Anot-er %rocess........................................................................................................2"
#")# )=3 5emotin%))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) !'
#")! 3emplate Client Code)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) !'
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e +
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 4/30
SpaceClaim Developers Guide
1 Introduction
1.1 Purpose
3his document is intended to provide an overvie1 o4 the SpaceClaim API and its 4undamental concepts) 3his is
the .est place to start 1hen learnin% a.out the API)
Another use4ul resource is the >SpaceClaim?API)chm@ help 4ile 1hich contains the 4ollo1in% sections:
• )etting tarted
3his e8plains ho1 to 1rite an add-in 1hich adds ne1 commands to SpaceClaim)
• /amples
3his provides do1nload lins to add(in command samples 1ritten in CB FB CCLI and Visual asic
)=3) 3hese samples sho1 ho1 to use the API to per4orm speci4ic tass such as traversin% assem.l$structure Euer$in% the topolo%$ and %eometr$ o4 a .od$ or creatin% notes)
• A%I !lass 0ibrar$
3his is the pro%rammin% documentation 4or the classes structs methods and properties in the API)
1.2 Programming Language
Althou%h the SpaceClaim API can .e called 4rom an$ )=3 pro%rammin% lan%ua%e e)%) CB FB CCLI Visual
asic )=3 all e8amples in this document are in CB)
1.3 Conventions
Hords in bold indicate t$pes or mem.ers in the API)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e *
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 5/30
SpaceClaim Developers Guide
2 vervie!
2.1 "rc#itecture
3he dia%ram sho1s a conceptual vie1 o4 the SpaceClaim architecture as presented throu%h the API)
For the purposes o4 this dia%ram each .o8 represents a module 1here each module maes use o4 other
modules .elo1 it in the dia%ram) 3he .o8 sies have no si%ni4icance)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e ,
Geometr$
Curve (Line, Circle, ...), Surface (Plane, Cylinder, ...), Matrix, Point, Direction, ...
%odeler
Body, Shell, Face, Edge, Loo, Fin,!ertex, "rac#er, ...
Grap#ics
$rahic, CurveDi%lay, &rro'Di%lay,"extDi%lay, ...
Docb&ects
Part, Coonent, De%ignBody,De%ignCurve, DatuPlane,
Dra'ingSheet, Dra'ing!ie', ...
'indo!s
indo', *nteractionContext,SectionCurve, ...
Commands
"dd(ins
&dd*n, &iExten%ion, CoandCa%ule, ...
Interaction Tools
)amespaces
SaceClai.&i.!+
SaceClai.&i.!+.$rahic%
SaceClai.&i.!+,Modeler
SaceClai.&i.!+.$eoetrySaceClai.&i.!+.Exten%iility
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 6/30
SpaceClaim Developers Guide
3hese modules are merel$ conceptual %roupin%s since the onl$ separation apparent in the API is the
separation in to namespaces 1hich are sho1n in di44erent colors in the dia%ram)
Listed 1ithin man$ o4 the modules in the dia%ram are e8amples o4 t$pes pu.lished .$ that module)
2.2 Doc b&ects
-4 particular importance is the distinction .et1een doc objects and the lo1er(level modeler and %eometric
o./ects) Doc o./ects as the name su%%ests .elon% to documents) 3he$ are 4irst class o./ects since the$
.elon% to a parent(child hierarch$ and the$ provide moniers 4or persistent identi4iers and update states 4or
associative update)
Man$ doc o./ects have re4erences to modeler or %eometr$ o./ects:
• Desi%n .odies desi%n 4aces and desi%n ed%es are doc o./ects that have a re4erence to a correspondin%
modeler o./ect: a .od$ 4ace or ed%e) ;ou can create a modeler .od$ 1ithout creatin% a desi%n .od$
.ut this means no document is modi4ied and nothin% appears in the 1indo1) 3his can .e use4ul i4 $ou
1ant to per4orm some modelin% calculation) ;ou ma$ or ma$ not create a desi%n .od$ at the end)
• Desi%n curves are doc o./ects that have a re4erence to a trimmed curve 1hich is a %eometr$ o./ect)
A%ain $ou can create curves and trimmed curves 1ithout ever creatin% a desi%n curve .ut desi%n
curves are 1hat %et displa$ed in 1indo1s) ;ou can create %raphics displa$ primitives 1hich re4erence
%eometr$ o./ects too and these also %et displa$ed in the 1indo1 althou%h displa$ primitives are not
doc o./ects)
• Datum planes are doc o./ects that have a re4erence to a plane 1hich is a %eometr$ o./ect) A%ain $ou
can create planes and other sur4aces 1ithout ever creatin% a datum plane)
3$picall$ the doc o./ect 1ill have more properties than the modeler or %eometr$ o./ect that it re4erences such
as name la$er visi.ilit$ or color)
2.3 Document Structure
A document contains the 4ollo1in% o./ects:
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e 0
Docuent
Part%Dra'ingSheet%
Layer%DocuentMaterial%
indo'%
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 7/30
SpaceClaim Developers Guide
Parts
A document al1a$s contains at least one part no1n as its main part and this represents the desi%n) I4 the
main part has internal components instances o4 other parts that .elon% to the same document the document
1ill contain other parts too)
Internal components are also used 4or .eam pro4iles mid(sur4ace parts and sheet metal un4olded parts)
3he structure o4 a part is descri.ed .elo1)
Dra!ing S#eets
A document contains ero or more dra1in% sheets)
3he structure o4 a dra1in% sheet is descri.ed .elo1)
La$ers
A document contains one or more la$ers) 3here is al1a$s a default layer and i4 $ou delete another la$er all its
o./ects are moved to the de4ault la$er) ;ou cannot delete the de4ault la$er) 3he de4ault la$er is not the same
as the active layer 1hich is the la$er to 1hich ne1 o./ects are assi%ned) 3he active la$er is a propert$ o4 the
1indo1)
%aterials
A document contains ero or more document materials 1hich are materials used .$ parts desi%n .odies or
.eams in that document)
'indo!s
A document contains one or more 1indo1s .ut it ma$ not have an$ 1indo1s loaded) I4 the document is
e8plicitl$ opened then its 1indo1s are also loaded and opened .ut i4 a document is loaded implicitl$ 4or
e8ample .ecause it is re4erenced 4rom another open document then its 1indo1s are not loaded)
A 1indo1 sho1s a scene 1hich is the root o4 the o./ect hierarch$ it displa$s) 3he 1indo1 scene can .e a part
or a dra1in% sheet .elon%in% to the same document)
3he 1indo1 also provides access to interaction contexts 1hich allo1 $ou to 1or in a speci4ic coordinate
space) 3he interaction conte8t presents the current selection in that coordinate space) A use4ul interaction
conte8t is the active context 1hich is the conte8t in 1hich the user is 1orin%)
2.* Part Structure
3he SpaceClaim o./ect model is Euite 4lat 1ith the part .ein% a .ucet 4or man$ o./ects:
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e 7
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 8/30
SpaceClaim Developers Guide
Components
A part contains ero or more components) A component is an instance o4 another template part) 3he template
part ma$ .elon% to the same document an internal component or it ma$ .elon% to another document an
e8ternal component)
Design +odies
A part contains ero or more desi%n .odies) A desi%n .od$ can .e open a sur4ace .od$ or closed a solid
.od$) A desi%n .od$ contains desi%n 4aces and desi%n ed%es)
Design Curves
A part contains ero or more desi%n curves) Desi%n curves have +D %eometr$ even thou%h the$ are o4ten
setched in a plane) For e8ample i4 $ou cop$ and paste desi%n ed%es desi%n curves are created and these
need not lie in a plane)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e '
Part ...
Co(onent% De%ign
Bodie%De%ignCurve%
Datu(Plane%
CoordinateSy%te(%
De%ignFace%
De%ign
Edge%
De%ignCurve%
-ote%
Sot )eldoint%
Co(onent%
*(age%Bea(%
... Part
Sheet MetalBend%
Coordinate &xe%
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 9/30
SpaceClaim Developers Guide
Desi%n curves can also .elon% to datum planes and dra1in% sheets)
Datum Planes
A part contains ero or more datum planes) As 1ell as servin% as construction planes as the name su%%estsdatum planes can also contain desi%n curves and te8t notes 1hich lie in the plane) Hhen the datum plane is
moved its children are moved too)
Coordinate S$stems
A part contains ero or more coordinate s$stems) A coordinate s$stem contains three mutuall$ perpendicular
coordinate a8es)
3he 1orld coordinate s$stem 1hich can .e displa$ed in the user inter4ace does not .elon% to an$ document
and is not presented throu%h the API)
S#eet %etal +ends
I4 a part is a sheet metal part then it contains ero or more sheet metal .ends 1hich mi%ht .e c$lindrical or
conical) I4 a part is a sheet metal part then it has a sheet metal aspect 1hich is a companion o./ect presentin%
sheet metal in4ormation includin% .ends)
+eams
A part contains ero or more .eams 1hich have a trimmed curve path a planar cross section and in4ormation
a.out the position and orientation o4 the cross section relative to the .eam path)
Spot 'eld ,oints
A part contains ero or more spot 1eld /oints) A spot 1eld /oint has a collection o4 spot 1elds each o4 1hich
1elds t1o or more points on desi%n 4aces)
Images
A part contains ero or more ima%es) An ima%e is a picture or video either positioned in space or 1rapped
onto a desi%n 4ace) An ima%e can also .elon% to a dra1in% sheet)
2.- Dra!ing S#eet Structure
A dra1in% sheet contains the 4ollo1in% doc o./ects:
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e 9
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 10/30
SpaceClaim Developers Guide
Dra!ing ie!s
A dra1in% sheet contains ero or more dra1in% vie1s) A dra1in% vie1 is conceptuall$ similar to a component
since it instantiates a part) In the case o4 a dra1in% vie1 the placement trans4orm also contains the vie1 scale)
Dra1in% vie1s can .e clipped and sectioned)
Design Curves
A dra1in% sheet contains ero or more desi%n curves 1hich lie in the plane o4 the sheet) Desi%n curves can
also .elon% to parts and datum planes)
)otes
A dra1in% sheet contains ero or more te8t notes)
Images
A dra1in% sheet contains ero or more ima%es) An ima%e is a picture or video positioned on the dra1in% sheet)
An ima%e can also .elon% to a part)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #"
Dra'ingSheet
Dra'ing!ie'%
De%ignCurve%
-ote% *(age%
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 11/30
SpaceClaim Developers Guide
3 Documents and Doc b&ects
3.1 vervie!
A Document is the unit o4 loadin% and savin%) Assumin% it has .een saved a document corresponds to a
SpaceClaim scdoc 4ile on dis)
A DocObject is an o./ect that .elon%s to a document) Doc o./ects are not the onl$ o./ects that %et saved 1hen
the document is saved .ut the$ are the onl$ o./ects that have a Document propert$) 8amples o4 doc o./ects
include: %art !omponent Designod$ Design&ace Datum%lane and ote)
Doc o./ects provide:
• A parent(child tree containment hierarch$)
•
Moniers 4or persistent identi4ication)• 6pdate states to indicate that the doc o./ect has chan%ed)
• Custom attri.utes 4or storin% +rd part$ data)
3.2 Parent(C#ild /ierarc#$
Doc o./ects are part o4 a parent(child containment hierarch$ 1here the parent represents the container and
the children represent the contents) I4 a doc o./ect is deleted all its descendants its children recursivel$ are
also deleted)
For e8ample a %art contains ero or more Designod$ o./ects each o4 1hich contains one or more Design&ace
o./ects) 3he parent o4 a desi%n 4ace is a desi%n .od$ and the parent o4 a desi%n .od$ is a part) Similarl$ adesi%n .od$ is a child o4 a part and a desi%n 4ace is a child o4 a desi%n .od$)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e ##
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 12/30
SpaceClaim Developers Guide
Public static void Example(DesignBody desBody) {
Part part = desBody.Parent;
// a part is a root obect! so it "as no parent
Debug.#ssert(part.Parent == null);
Debug.#ssert(part.$oot == part);
// %et&"ildren' returns immediate c"ildren o* type
*oreac" (Doc+bect c"ild in part.%et&"ildren'Doc+bect()) {
// Parent returns t"e immediate parent
Debug.#ssert(c"ild.Parent == part);
,
// DesignBody.-aces is euivalent to %et&"ildren'Design-ace
*oreac" (Design-ace des-ace in desBody.-aces) {
// $oot returns t"e topmost parent
Debug.#ssert(des-ace.$oot == part);
,
// %etDescendants' gets all nested c"ildren o* type
// t"e searc" starts it" t"e obect itsel*
*oreac" (Design-ace des-ace in part.%etDescendants'Design-ace()) {
// %et#ncestor' crals up t"e parent c"ain to *ind an obect o* type
Debug.#ssert(des-ace.%et#ncestor'Part() == part);
// t"e searc" starts it" t"e obect itsel*
Debug.#ssert(des-ace.%et#ncestor'Design-ace() == des-ace);
,
,
3he parent chain continues up the hierarch$ until the root o./ect is reached) 3his is the topmost parent 1hich
itsel4 has no parent its parent is null) 8amples o4 root o./ects are: %art Drawing-eet and 0a$er)
All doc o./ects in the same parent(child hierarch$ .elon% to the same document) 3he Document class provides
properties to access its root o./ects: ain%art %arts Drawing-eets and 0a$ers)
3.3 Parts and Components
A %art contains ero or more Designod$ o./ects and ero or more !omponent o./ects) 3his means a part can
contain .oth desi%n .odies and components in 1hich case it is neither a pure piece part nor a pure assem.l$)
3his is supported so that the interactive user can restructure desi%n .odies into components or vice versa)
A component is an instance o4 a template part) It has a placement matri8 to position the component into
assem.l$(space) 3he template is neither a child nor a parent o4 the component) I4 the parent(child hierarch$ is
visualied as an inverted tree structure 1ith the root at the top and lea4 nodes at the .ottom then the
template is a side1a$s re4erence to another part 1hich is the root o4 another hierarch$)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #!
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 13/30
SpaceClaim Developers Guide
3he template part ma$ live in the same document as the component %ivin% rise to 1hat the interactive user
1ould call an internal component or it ma$ live in another document %ivin% rise to an external component )
Strictl$ speain% itJs the template part that is either internal or e8ternal not the component itsel4)
3.* Instances and ccurrences
Dra1in% vie1s are also instances o4 template parts since a dra1in% vie1 trans4orms a part into paper(space
much lie a component trans4orms a part into assem.l$(space) oth !omponent and Drawingiew inherit
4rom Instance)
An Instance produces a trans4ormed occurrence o4 a *emplate o./ect alon% 1ith occurrences o4 its children
recursivel$) 3he template o./ect is al1a$s a root o./ect) 3he trans4ormation is de4ined .$ the %lacement
matri8) 3he !ontent propert$ provides access to the occurrence o4 the template o./ect 1hich is is a child o4
the instance)
3he template o./ect is not copied) Instead each occurrence is a li%ht1ei%ht 1rapper a trans4ormed
representation o4 its ori%inal counterpart) Geometr$ presented .$ the occurrence is in instance(space 1hich
means assem.l$(space 4or a component and paper(space 4or a dra1in% vie1) Hhen the ori%inal o./ect ischan%ed or the instance placement is chan%ed the occurrence chan%es implicitl$) An$ chan%es made to an
occurrence are actuall$ made to the ori%inal instead)
-ccurrences .elon% to the same parent(child hierarch$ as the instance that %ives rise to them) 3he entire
parent(child hierarch$ is in the same coordinate(space)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #+
Part
Part
Part
Co(onent
*Part
Co(onent
*Part
*Co(onent
*Part
De%ignBody*De%ignBody*De%ignBody
"e(late
"e(late
/riginal
/riginal
/riginal
/riginal
/riginal
/riginal
Ma%ter
/ccurrence
0ey Assembl
Sub-Assembl
Piece Part
Content
ContentContent
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 14/30
SpaceClaim Developers Guide
3.- ccurrence C#ains
I4 the template o./ect itsel4 contains instances occurrences o4 occurrences are produced) For e8ample this
happens 1ith a t1o(level assem.l$ since the top(level assem.l$ contains a component that instantiates a su.(
assem.l$ part 1hich itsel4 contains a component that instantiates a piece part)
3.0 General b&ects and %asters
In %eneral a doc o./ect is either an occurrence or a master ) Hhen dealin% 1ith general doc o./ects doc
o./ects that mi%ht .e occurrences or masters inter4aces are used e)%) I%art I!omponent and IDesignod$)
3hese all derive 4rom IDocObject)
3here are some methods and properties that 4or theoretical or practical reasons are not presented .$
occurrences and are there4ore onl$ presented .$ masters) Hhen dealin% 1ith masters classes are used e)%)
%art !omponent and Designod$) 3hese all derived 4rom DocObject 1hich implements IDocObject)
%art implements I%art !omponent implements I!omponent and so on so a master supports ever$thin% that
a %eneral o./ect supports and o4ten more .esides)
=ote that althou%h %art is al1a$s a root o./ect I%art ma$ or ma$ not .e a root o./ect) I4 the I%art happens to
.e a master then it is a root o./ect .ut i4 it happens to .e an occurrence its parent 1ill .e an I!omponent or
an IDrawingiew)
3. riginals and %asters
IDocObject is the .ase 4or all doc o./ect 4unctionalit$) It provides mem.ers 4or traversin% the parent(child
hierarch$ !-ildren )et!-ildren* )etDescendants* %arent )etAncestor* 7oot 1hich 1e have
alread$ met and it also provides mem.ers 4or traversin% the occurrence structure:
• Original K Gets the ori%inal IDocObject else null i4 this is a master)
• aster K Gets the ultimate ori%inal i)e) the DocObject master at the end o4 the occurrence chain) I4
the o./ect is a master the o./ect itsel4 is returned)
• Instance K Gets the instance that produces this occurrence else null i4 this is a master)
3. Transforming to %aster(Space
3he most common o4 these properties to use is aster .ecause the master can provide methods and
properties not availa.le on the %eneral o./ect) Since the master mi%ht .e in a di44erent coordinate(space to
the %eneral o./ect *rans#orm*oaster can .e used to %et the trans4orm that maps o./ects in %eneral(space to
o./ects in master(space)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #*
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 15/30
SpaceClaim Developers Guide
Public static void Example(0component comp! -rame placement) {
// t"e Placement property is available on &omponent! but not 0component
&omponent master = comp.1aster;
// map placement *rame into master2space
1atrix transo1aster = comp.rans*ormo1aster;
-rame masterPlacement = transo1aster 3 placement;
// apply master placement *rame to master component
master.Placement = 1atrix.&reate1apping(masterPlacement);
,
3. Getting ccurrences
2avin% done some 1or in master(space it ma$ .e necessar$ to o.tain an o./ect in %eneral(space) 3his is
common i4 the ori%inal o./ect came 4rom the 1indo1 selection and $ou 1ish to set a ne1 selection in the
1indo1)3he 1indo1 selection is al1a$s in 1indo1(space i)e) in the same coordinate(space as the scene sho1n in that
1indo1 the same coordinate(s$stem as 8indow.cene) So i4 the 1indo1 sho1s an assem.l$ then the
selected o./ects are in assem.l$(space)
)etOccurrence can .e used to o.tain an o./ect in %eneral(space) It returns an occurrence that is similar to a
companion o./ect supplied) =ote that the companion o./ect is a %eneral o./ect 1hich ma$ or ma$ not .e an
occurrence) I4 it is an occurrence then an eEuivalent occurrence is returned 4or the su./ect) I4 it is not an
occurrence then the su./ect itsel4 is returned) 3his allo1s $ou to 1rite code that 1ors correctl$ 1ithout
testin% 1hether the o./ect is in 4act an occurrence)
Public static void Example() {
4indo indo = 4indo.#ctive4indo;
i* (indo == null)
return;
// t"e selected component is in indo2space
0&omponent old&omp = indo.5ingle5election as 0&omponent;
i* (old&omp == null)
return;
// copy t"e component master
&omponent old1aster = old&omp.1aster;
&omponent ne1aster = &omponent.&reate(old1aster.Parent! old1aster.emplate);
ne1aster.Placement = old1aster.Placement;
// get an occurrence o* t"e ne master in indo2space
0&omponent ne&omp = ne1aster.%et+ccurrence(old&omp);
// select t"e nely created component
indo.5ingle5election = ne&omp;
,
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #,
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 16/30
SpaceClaim Developers Guide
* "pplication Integration
*.1 Persistent Identifiers
Doc o./ects have persistent identi4iers called monikers 1hich can .e recorded and later resolved to return the
doc o./ect a%ain) 3he oni9er propert$ returns a monier 4or the doc o./ect and the 7esolve method returns
the doc o./ect a%ain)
Internall$ master doc o./ects have an identi4ier 1hich is %lo.all$ uniEue) -ccurrences are identi4ied .$ the
instance 1hich is a master alon% 1ith the ori%inal o./ect 1hich mi%ht itsel4 .e an occurrence) A monier is an
o./ect that encapsulates the identi4iers o4 the one or more master o./ects involved in the identit$ o4 the
su./ect)
3o record a monier $ou can record its strin% representation usin% *otring) 3he len%th o4 this strin% depends
on the num.er o4 master o./ects involved) 3he 4ormat o4 this strin% is not documented so $ou should notattempt to construct or modi4$ such a strin%)
3o convert the strin% representation .ac into a monier $ou can use &romtring)
public static void Example(0Design-ace des-ace) {
Document doc = des-ace.Document;
// all doc obects provide a moni6er
1oni6er'0Design-ace des-ace1oni6er# = des-ace.1oni6er;
// resolve t"e moni6er in t"e document to obtain t"e original obect
Debug.#ssert(des-ace1oni6er#.$esolve(doc) == des-ace);
// t"e string representation can be recorded
string moni6erext = des-ace1oni6er#.o5tring();
// t"e moni6er can be reconstructed *rom t"e string
1oni6er'0Design-ace des-ace1oni6erB = 1oni6er'0Design-ace.-rom5tring(moni6erext);
Debug.#ssert(des-ace1oni6erB.$esolve(doc) == des-ace);
,
3o resolve a monier a document must .e provided as the conte8t) SpaceClaim allo1s more than one version
o4 the same scdoc 4ile to .e loaded at the same time so the same monier could potentiall$ .e resolved in
more than one document)
Since the internal identi4iers involved are %lo.all$ uniEue there is no dan%er o4 resolvin% the monier in an
unrelated document) I4 $ou attempt to do so null 1ill .e returned to indicate that the o./ect 1as not 4ound)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #0
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 17/30
SpaceClaim Developers Guide
*.2 4eplacements
I4 the doc o./ect has .een deleted 7esolve returns null to indicate that the o./ect 1as not 4ound) Sometimes
doc o./ects can %et replaced durin% a command) For e8ample i4 a desi%n 4ace is split durin% a modelin%
operation it 1ill .e replaced .$ t1o ne1 desi%n 4aces) Perhaps one o4 these ne1 desi%n 4aces %ets split itsel4or perhaps one o4 them %ets deleted)
ehind the scenes replacements are recorded and 1hen 7esolve is called i4 the o./ect has .een replaced the
monier automaticall$ returns one o4 the survivors or null i4 there are no survivors)
• I4 it is important to no1 1hether the o./ect is a survivor rather than the ori%inal o./ect $ou can
compare its monier 1ith the monier $ou alread$ have usin% the operator) I4 the o./ect is a
survivor it 1ill have a di44erent monier)
• I4 it is important to o.tain all survivors 7esolveurvivors can .e used instead) =ote that this method
onl$ returns survivin% replacements so i4 the o./ect hasnJt .een replaced at all no survivors are
returned)
*.3 5pdate States
A doc o./ect master has an update state 1hich tells $ou i4 the o./ect has chan%ed)
ach time the doc o./ect master is chan%ed its update state chan%es) Conversel$ i4 the update state has not
chan%ed then the o./ect has not chan%ed) Hhen an o./ect is chan%ed due to an undo or redo operation its
update state is undone or redone too)
3he update state is persistent so $ou can store its strin% representation and use it in another SpaceClaim
session)
public static void Example(Design-ace des-ace) {
// doc obect masters provide an update state7pdate5tate be*ore5tate# = des-ace.7pdate5tate;
// t"e string representation can be recorded
string stateext = be*ore5tate#.o5tring();
1odi*yDesignBody();
// test "et"er t"e design *ace as c"anged
i* (des-ace.7pdate5tate 8= be*ore5tate#)
Debug.4rite9ine(:Design *ace as c"anged.:);
// t"e update state can be reconstructed *rom t"e string
7pdate5tate be*ore5tateB = 7pdate5tate.-rom5tring(stateext);
Debug.#ssert(be*ore5tate# == be*ore5tateB);
,
6pdate states are not provided 4or occurrences .ut $ou can store the update states o4 the instances involved
in the occurrence chain alon% 1ith the update state o4 the master) %at-*oaster returns these instances)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #7
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 18/30
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 19/30
SpaceClaim Developers Guide
- Storing Custom Data
-.1 Document Properties
Documents have t1o t$pes o4 properties:
• Core properties cover standard 4ields such as description subject title and creator ) 3he set o4 core
properties is 4i8ed) ;ou cannot create ne1 core properties)
• Custom properties allo1 +rd part$ applications to store data 1ith the document) ach custom propert$
is a name(value pair)
So that custom propert$ names do not clash 1hen di44erent applications choose a custom propert$ name the
name should .e pre4i8ed 1ith the application or add(in name as in the 4ollo1in% e8ample:
public static void Example(Document doc) {&ustomProperty.&reate(doc! :Banana4or6s.#pplicationersion:! <);
&ustomProperty property;
i* (doc.&ustomProperties.ry%etalue(:Banana4or6s.#pplicationersion:! out property))
Debug.#ssert((double) property.alue == <);
,
=ote that a document can contain more than one part so i4 $ou 1ant to store data 4or a part this is .est done
.$ storin% a custom attri.ute on the part master see ne8t topic)
-.2 Custom "ttributes
Doc o./ect masters provide custom attri.utes so that +rd part$ applications can store data) 31o t$pes o4
attri.ute are provided: te8t attri.utes and num.er attri.utes) An attri.ute is a name(value pair) A doc o./ect
can have a te8t attri.ute and a num.er attri.ute 1ith the same name)
So that attri.ute names do not clash 1hen di44erent applications choose an attri.ute name the name should
.e pre4i8ed 1ith the application or add(in name as in the 4ollo1in% e8ample:
public static void Example(DesignBody desBody) {
desBody.5etext#ttribute(:Banana4or6s.56in&ondition:! :$ipe:);
string s6inype;
i* (desBody.ry%etext#ttribute(:Banana4or6s.56in&ondition:! out s6inype))
Debug.#ssert(s6inype == :$ipe:);
,
Multiple values can .e stored as multiple attri.utes 1ith distinct names or the$ can .e 4ormatted into a sin%le
te8t strin% usin% tring.&ormat or an ML serialier)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e #9
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 20/30
SpaceClaim Developers Guide
-.3 "ttribute Propagation
Attri.utes applied to doc o./ect masters are propa%ated i4 the o./ect is replaced) For e8ample i4 a desi%n 4ace
has a te8t attri.ute and this 4ace is split durin% a modelin% operation the replacement desi%n 4ace 4ra%ments
1ill also carr$ the same te8t attri.ute)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !"
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 21/30
SpaceClaim Developers Guide
0 Identif$ing b&ects in "CIS and Parasolid 6iles
0.1 Identifiers During 78port
Hhen an ACIS or Parasolid 4ile is 1ritten either .$ the user or .$ callin% %art./port name attri.utes are
attached to 4ace and ed%e entities in the 4ile to indicate 1hich desi%n 4ace or desi%n ed%e master the$ came
4rom) 3his is use4ul i4 the model is chan%ed and then a ne1 4ile is e8ported since correspondin% 4aces and
ed%es 1ill have the same name attri.utes)
• An ACIS name attri.ute is a named attri.ute A335I?G=?=AM 1ith the attri.ute name
A335I?ACIS?=AM)
• A Parasolid name attri.ute is a s$stem attri.ute 1ith the name SDL3;SA?=AM)
Desi%n 4ace and desi%n ed%e masters have an /portIdenti#ier propert$ 1hich returns a strin% containin% the
value o4 the name attri.ute that is 1ritten 1hen the o./ect is e8ported)
0.2 6oreign Identifiers During Import and 78port
3here ma$ .e a reEuirement to import a model 4rom another s$stem modi4$ it in SpaceClaim and then e8port
it a%ain such that the other s$stem can trac the identit$ o4 4aces and ed%es durin% this round trip)
Hhen importin% an ACIS or Parasolid 4ile i4 an$ .od$ 4ace or ed%e entities have id attri.utes these are
converted to SpaceClaim te8t attri.utes on the resultin% desi%n .od$ desi%n 4ace or desi%n ed%e masters)
3hese te8t attri.utes have the reserved name Nid)
• An ACIS id attri.ute is a named attri.ute A335I?G=?=AM 1ith the attri.ute name
A335I?ACIS?ID)
• A Parasolid id attri.ute has the name A335I?PA5AS-LID?ID and has an attri.ute de4inition 1hich
is descri.ed in the documentation 4or the %art./port method)
Attri.utes applied to doc o./ect masters are propa%ated i4 the o./ect is replaced) For e8ample i4 a desi%n 4ace
has a te8t attri.ute and this 4ace is split durin% a modelin% operation the replacement desi%n 4ace 4ra%ments
1ill also carr$ the same te8t attri.ute)
Hhen e8portin% an ACIS or Parasolid 4ile i4 an$ desi%n .odies desi%n 4aces or desi%n ed%es have te8t
attri.utes 1ith the name Nid these are 1ritten as id attri.utes applied to resultin% ACIS or Parasolid
entities)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !#
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 22/30
SpaceClaim Developers Guide
Geometr$ and Topolog$
.1 5nbounded Geometr$ and Trimmed b&ects
In SpaceClaim %eometr$ is conceptuall$ un.ounded e)%) a %lane e8tends inde4initel$ a p-ere is complete
and a 0ine is in4inite in len%th) -n top o4 this there are trimmed o./ects 1hich are .ounded and there4ore
provide additional properties:
• I*rimmed!urve K a .ounded curve) It provides 0engt- and parametric ounds)
• I*rimmedur#ace K a .ounded sur4ace) It provides Area %erimeter and a parametric o/,)
• I*rimmedpace K a .ounded re%ion o4 +D space) It provides olume and ur#ace Area)
All o4 these inherit 4rom Iounded 1hich provides )etoundingo/)
A trimmed curve has a )eometr$ propert$ that returns the !urve and a trimmed sur4ace has a )eometr$propert$ that returns the ur#ace) A trimmed re%ion even has a )eometr$ propert$ that returns a pace
o./ect representin% all o4 Cartesian +D space)
3rimmed curves and trimmed sur4aces also have an Is7eversed propert$ 1hich tells $ou 1hether the sense o4
the o./ect is the opposite o4 the sense o4 its %eometr$) 3he sense o4 a trimmed curve is its direction and the
sense o4 a trimmed sur4ace is 1hich 1a$ its normals 4ace)
.2 Topolog$
3he topolo%$ o4 a model is made o4 od$ &ace and dge o./ects alon% 1ith other o./ects shells loops 4ins
and vertices that descri.e in more detail ho1 the$ connect up)
• od$ inherits 4rom I*rimmedpace) It also provides &aces and dges)
• &ace inherits 4rom I*rimmedur#ace) It also provides surroundin% dges)
• dge inherits 4rom I*rimmed!urve) It also provides ad/acent &aces)
3opolo%$ classes have more in4ormation than the trimmed o./ect inter4aces that the$ implement:
• 3rimmed o./ect inter4aces have no concept o4 connectivit$)
• Althou%h the$ can return area and volume respectivel$ I*rimmedur#ace and I*rimmedpace sa$
nothin% a.out the shape o4 their .oundar$) Hith I*rimmed!urve the .oundar$ has no shape as such
since the curve is simpl$ .ounded .$ parameter values)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !!
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 23/30
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 24/30
SpaceClaim Developers Guide
.- Design +odies
Oust as a Design!urve is a doc o./ect 1hich has a -ape o4 t$pe I*rimmed!urve there is a similar pattern 4or
.odies:
• A Designod$ has a -ape o4 t$pe od$)
• A Design&ace has a -ape o4 t$pe &ace)
• A Designdge has a -ape o4 t$pe dge)
3his is onl$ true 4or these doc o./ect masters) For the correspondin% %eneral o./ects less in4ormation is
availa.le:
• IDesignod$ has a -ape o4 t$pe I*rimmedpace)
• IDesign&ace has a -ape o4 t$pe I*rimmedur#ace)
• IDesigndge has a -ape o4 t$pe I*rimmed!urve)
3his means $ou can onl$ access detailed topolo%$ in4ormation such as loops and 4ins 4rom masters:
public static void Example(0Design-ace des-ace) {
// e can get t"e area *rom t"e 0rimmed5ur*ace s"ape
double area = des-ace.5"ape.#rea;
// but to access loops! e need to use t"e master
Design-ace des-ace1aster = des-ace.1aster;
// i* e access geometry! remember e are no in master2space
1atrix transo1aster = des-ace.rans*ormo1aster;
DesignBody desBody1aster = des-ace1aster.Parent;
// t"e master 5"ape is a -ace rat"er t"an an 0rimmed5ur*ace
-ace *ace = des-ace1aster.5"ape;
*oreac" (9oop loop in *ace.9oops)
*oreac" (-in *in in loop.-ins) {
Edge edge = *in.Edge;
// get *rom s"ape bac6 to doc obect master
DesignEdge desEdge1aster = desBody1aster.%etDesignEdge(edge);
// *rom master to occurrence euivalent to des-ace
0DesignEdge desEdge = desEdge1aster.%et+ccurrence(des-ace);
,
,
2o1ever the %eneral inter4aces do provide some convenient connectivit$ traversals at the doc o./ect level:
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !*
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 25/30
SpaceClaim Developers Guide
public static void Example(0Design-ace des-ace) {
0DesignBody desBody = des-ace.Parent;
// t"e Edge property returns t"e edges in t"e *ace boundary
*oreac" (0DesignEdge desEdge in des-ace.Edges) {
Debug.#ssert(desEdge.Parent == desBody);
// t"e -aces property returns t"e *aces t"at meet at t"is edge
Debug.#ssert(desEdge.-aces.&ontains(des-ace));
,
,
.0 S#ape in General
Shape also applies to doc o./ects that have untrimmed %eometr$ e)%) a datum plane) Datum%lane
implements I:asur#ace-ape and its -ape not surprisin%l$ is a Iur#ace-ape) Compare this to Design&ace
1hich implements I:as*rimmedur#ace and has a -ape o4 t$pe I*rimmedur#ace) 3his parallel path e8ists.ecause I:as*rimmedur#ace is derived 4orm I:asur#ace-ape and I*rimmedur#ace is derived 4rom
Iur#ace-ape) 3here4ore 1hether the %eometr$ is untrimmed or trimmed there is al1a$s a t1o step
traversal 4irst to -ape and then to )eometr$:
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !,
*De%ignFace 1*2a%"ri((edSurface 1*2a%SurfaceShae
*Dra'ingSheet 1*2a%"ri((edSurface 1*2a%SurfaceShae
Doc b&ect
*"ri((edSurface 1*SurfaceShae
Surface
Shae
Shae
$eo(etry
● &rea●Box3!●*%4ever%ed
●Evaluate●Pro5ectPoint
S#ape Geometr$
*Datu(Plane 1*2a%SurfaceShae
*SurfaceShae$eo(etryShae
●*%4ever%ed
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 26/30
SpaceClaim Developers Guide
"ccurac$
.1 Linear and "ngular 4esolution
Internall$ %eometric calculations are per4ormed to machine dou.le precision) Hhen comparin% the results o4
calculations values should al1a$s .e compared to 1ithin a speci4ic resolution) 3hese resolutions are provided
.$ the Accurac$ class:
• 31o len%ths are considered eEual i4 their di44erence is less than 0inear7esolution)
• 31o an%les are considered eEual i4 their di44erence is less than Angular7esolution)
For e8ample 1hen !ontains%oint is called to determine 1hether a point lies in a sur4ace internall$ the
distance 4rom the sur4ace mi%ht .e calculated and the result is true i4 this distance is less than
0inear7esolution)
.2 Comparing Lengt#s and "ngles
3he Accurac$ class provides methods 4or comparin% len%ths and an%les)
3he !ompare0engt-s method taes t1o ar%uments lengthA and lengthB and returns an inte%er result:
• (# lengthA is less than lengthB)
• " lengthA is eEual to lengthB to 1ithin linear resolution)
• # lengthA is %reater than lengthB)
3his method provides %eneral comparison o4 t1o len%ths .ut 4or common situations such as comparin% 1ith
ero or testin% 1hether t1o values are eEual simpler and more reada.le methods can .e used:
public static void Example(double lengt"#! double lengt"B) {
// same as &ompare9engt"s(lengt"#! lengt"B) == @
bool eual9engt"s = #ccuracy.Eual9engt"s(lengt"#! lengt"B);
// same as &ompare9engt"s(lengt"#! @) == @
bool lengt"0sero = #ccuracy.9engt"0sero(lengt"#);
// same as &ompare9engt"s(lengt"#! @) @
bool lengt"0sPositive = #ccuracy.9engt"0sPositive(lengt"#);
// same as &ompare9engt"s(lengt"#! @) ' @
bool lengt"0segative = #ccuracy.9engt"0segative(lengt"#);
,
Correspondin% methods are provided 4or an%les: !ompareAngles ;ualAngles AngleIs<ero AngleIs%ositive
and AngleIsegative)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !0
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 27/30
SpaceClaim Developers Guide
.3 Comparing 9:; b&ects
3he .asic ;< t$pes %oint ector Direction o/ and &rame have resolution tests .uild in so $ou can
compare o./ects usin% the operator) For e8ample t1o points are eEual i4 the distance .et1een them is less
than the linear resolution and t1o directions are eEual i4 the an%le .et1een them is less than then an%ularresolution)
public static void Example(Plane plane! Point point) {
// proect point onto plane
5ur*aceEvaluation eval = plane.ProectPoint(point);
Point point+nPlane = eval.Point;
// points are t"e same i* less t"an linear resolution apart
bool plane&ontainsPoint = point == point+nPlane;
// &ontainsPoint is more e**icient! but gives t"e same result
Debug.#ssert(plane&ontainsPoint == plane.&ontainsPoint(point));
,
.* Comparing 5 b&ects
3he same is not true 4or the sur4ace parameter 6V t$pes %oint, ector, Direction, and o/, or 4or
the curve parameter t$pe Interval) 3hese t$pes do not no1 1hether the parameteriation the$ represent is
linear an%ular or some other t$pe) For e8ample 4or a plane the 6 parameteriation is linear .ut 4or a
c$linder the 6 parameteriation is an%ular) For a =65S sur4ace the 6 parameteriation is neither linear nor
an%ular)
3here4ore $ou should not use the operator 4or these t$pes) Hhen comparin% parameters $ou should use
the appropriate len%th or an%le comparison method 4or each o4 the 6 and V values) For =65S
parameteriation an%ular comparison could .e used .ut it is sa4est to evaluate points and compare theseinstead)
.- Comparing Geometr$
3o sa$ that t1o sur4aces or t1o curves are eEual is am.i%uous since there is more than one interpretation o4
the concept) For e8ample 1ith t1o planes:
• 3he$ could .e coplanar .ut the normals could .e opposed)
• 3he$ could .e coplanar 1ith normals havin% the same sense .ut their 4rames and hence their
parameteriation mi%ht .e di44erent)
• 3he$ mi%ht .e identical in ever$ 1a$)
;ou should not use the operator 1ith sur4ace and curve t$pes since that 1ill onl$ test 4or re4erence
eEualit$)
)eometr$.Is!oincident and I*rimmed!urve.ls!oincident are provided to mae comparisons) 3he$ onl$ test
4or coincidence 1hich means an$ o4 the a.ove cases 1ould pass)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !7
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 28/30
SpaceClaim Developers Guide
5nits
.1 S$stem 5nits and 5ser 5nits
Internall$ SpaceClaim 1ors in SI units: meters ilo%rams and seconds) 3he API also 1ors in SI units)
3he user ma$ .e 1orin% in some other units .ut internall$ the units are still SI units) Conversions are done
1hen values are presented to the user or input .$ the user)
3he 8indow class provides conversions .et1een s$stem units SI units and user units)
.2 utputting alues
&ormat0engt- produces a len%th strin% that can .e presented to the user 1hich includes the units s$m.ol) As
1ell as per4ormin% units conversion this method also 4ormats the output accordin% to 1hether the user is1orin% in decimals or 4ractions)
&ormatAngle provides the same 4unctionalit$ 4or an%les)
.3 Inputting alues
3o parse a len%th strin% entered .$ the user $ou can use *r$%arse0engt-) As 1ell as convertin% to s$stem
units this method also handles e8pressions and values 1ith e8plicit units stated:
• # ! + Q ++ + !*+
• #cm # #! mm ")"##,
*r$%arseAngle provides the same 4unctionalit$ 4or an%les)
.* Custom Conversions
I4 $ou need more control over the 4ormattin% $ou can use 0engt-!onversion and 0engt-$mbol 4or len%ths or
Angle!onversion and Angle$mbol 4or an%les)
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !'
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 29/30
SpaceClaim Developers Guide
1< Calling T#e "PI 6rom "not#er Process
1<.1 .)7T 4emoting
3he SpaceClaim API uses )=3 5emotin% 1hich allo1s calls to .e made 4rom a di44erent application domain or
4rom a di44erent process) Currentl$ onl$ di44erent processes on the same computer are supported)
SpaceClaim add(ins are t$picall$ run in a separate application domain in the SpaceClaim process althou%h this
is controlled .$ the -ost attri.ute in the add(in mani4est 4ile) Hhen inte%ratin% SpaceClaim 1ith another
application it ma$ .e more convenient to create a add(in 4or the other application instead 1hich calls the
SpaceClaim API 4rom the other applicationJs process)
1<.2 Template Client Code
2ere is some template code 4or an API client in another process) In this e8ample the client is a simple console
application)
static void 1ain(stringFG args) {
// 0nitiali>e must be called be*ore using t"e #P0
#pi.0nitiali>e();
5ession session = %et5pace&laim5ession();
bool start5pace&laim = session == null;
i* (start5pace&laim) {
session = 5ession.5tart(H@@@@); // H@ secs timeout
i* (session == null) {
Debug.-ail(:-ailed to start 5pace&laim.:);
return;
,,
// attac" to 5pace&laim session be*ore ma6ing ot"er calls
#pi.#ttac"o5ession(session);
// i* t"e user exits 5pace&laim! exit t"is client app too
Process process = Process.%etProcessBy0d(session.Process0d);
process.Enable$aisingEvents = true;
process.Exited I= delegate {
Debug.4rite9ine(:7ser exited 5pace&laim.:);
Environment.Exit(@);
,;
Execute#pi&ode();
&onsole.4rite9ine(:Press Enter to *inis".:);
&onsole.$ead9ine();
// i* e started 5pace&laim! e s"all stop it
i* (start5pace&laim)
session.5top();
,
Cop$ri%ht & !""'(!"#! SpaceClaim Corp) All ri%hts reserved) Pa%e !9
8/20/2019 Developers Guide (1)
http://slidepdf.com/reader/full/developers-guide-1 30/30
SpaceClaim Developers Guide
static 5ession %et5pace&laim5ession() {
*oreac" (5ession session in 5ession.%et5essions())
return session;
return null;
,
e4ore the API can .e used Api.Initiali=e must .e called) For add(ins this is done automaticall$ in the
AddInase constructor .ut 4or standalone client applications in a separate process Api.Initiali=e must .e
called e8plicitl$)
3hen Api.Attac-*oerver must .e called) A%ain 4or add(ins this is done automaticall$ in the AddInase
constructor) -nce the API is attached to a server it cannot .e detached or re(attached) Instead separate
application domains can .e used to attach to separate servers and this even allo1s connection to more than
one server at once)
Rend