API Dev
API Dev
05/12/2001 Page 1
Portions licensed from D-Cubed Ltd. DCM-2D is a trademark of D-Cubed LTD. DCM-2D Copyright D-Cubed Ltd. 1989-1997 The license management portion of this product is based on lan License Manager 1997, lan Computer Group, Inc. All rights reserved. lan License Manager is a trademark of lan Computer Group, Inc. International CorrectSpell English spelling correction system 1993 by INSO Corporation. All rights reserved. Reproduction or disassembly of embodied algorithms or database prohibited. SmartHeap memory manager Copyright 1991-1996 by Arthur D. Applegate. All rights reserved. All other brand names, product names or trademarks belong to their respective holders. GOVERNMENT USE Use, duplication, or disclosure by the U. S. Government is subject to restrictions as set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
05/12/2001 Page 2
Table of Contents
Integration of MDT System Attributes and MCADAPI Attributes ....................... 46 MCAD API Instantiable Attributes ........................................................................... 47
Notation............................................................................................................................................... 47 Problem ............................................................................................................................................... 47 Instantiable Attributes....................................................................................................................... 47 Defining Attribute Classes............................................................................................................. 47 Example............................................................................................................................................... 48 Attributes From Other Applications ................................................................................................ 49 Attributes To and From an Attribute Definition File ..................................................................... 49 Example............................................................................................................................................... 49 Creating Instantiable Attribute Instances........................................................................................ 49 Transactions ....................................................................................................................................... 50 Accessing Attribute Fields ................................................................................................................. 50 Standard Attributes ........................................................................................................................... 50 Function Reference ............................................................................................................................ 50
AmiStatus Overview.................................................................................................... 62
CLASS AmiStatus .............................................................................................................................. 63
File Structures.............................................................................................................. 64
MDT Part Only Files ......................................................................................................................... 64
05/12/2001 Page 4
Table of Contents
Table of Contents
AmiStatus amiGetAttClassFields ................................................................................................... 81 AmiStatus amiGetAttClassName ................................................................................................... 82 AmiStatus amiGetAttField ............................................................................................................ 82 AmiStatus amiGetAttField ............................................................................................................ 82 AmiStatus amiMakeInstAtt ........................................................................................................... 83 AmiStatus amiReadAttClassesFromFile......................................................................................... 83 AmiStatus amiSetAttField ............................................................................................................. 83 AmiStatus amiSetAttField ............................................................................................................. 83 AmiStatus amiUndefineAttClass ................................................................................................... 84 AmiStatus amiWriteAttClassToFile ............................................................................................... 84 AmiStatus amiWriteAttClassesToFile ............................................................................................ 84
Miscellaneous.............................................................................................................................. 84
AmiStatus amiApplyColorOverride ............................................................................................... 84 AmiStatus amiCreateSystemAttribute ............................................................................................ 85 AmiStatus amiEndExternalEdit ..................................................................................................... 85 AmiStatus amiEraseObject ............................................................................................................ 85 AmiStatus amiGetAssociatedDoc .................................................................................................. 85 AmiStatus amiGetColorOverride ................................................................................................... 85 AmiStatus amiGetCurrentDatabase ............................................................................................... 86 AmiStatus amiGetDbIdsFromKey ................................................................................................. 86 AmiStatus amiGetExecVersion ..................................................................................................... 86 AmiStatus amiGetFileVersion ....................................................................................................... 86 AmiStatus amiGetObjectName ...................................................................................................... 86 AmiStatus amiGetObjectState ....................................................................................................... 86 AmiStatus amiGetObjectVisibility................................................................................................. 87 AmiStatus amiGetSystemAttributeName ....................................................................................... 88 AmiStatus amiGetSysVar .............................................................................................................. 88 AmiStatus amiHasColorOverride .................................................................................................. 88 AmiStatus amiIsDirectlyEditable ................................................................................................... 89 AmiStatus amiRemoveColorOverride ............................................................................................ 89 AmiStatus amiSetObjectName ...................................................................................................... 89 AmiStatus amiSetObjectVisibility ................................................................................................. 89 AmiStatus amiSetSystemAttributeName ........................................................................................ 90 AmiStatus amiSetSysVar .............................................................................................................. 90 AmiStatus amiStartExternalEdit .................................................................................................... 90
Parametric Modeling ......................................................................................................................... 91 Parameter Handling ................................................................................................................. 91 AmiStatus amiCreateParam ........................................................................................................... 91 AmiStatus amiEvalParamExpress .................................................................................................. 91 AmiStatus amiGetGlobalParams ................................................................................................... 91 AmiStatus amiGetParamComment ................................................................................................ 92 AmiStatus amiGetParamDeps ....................................................................................................... 92 AmiStatus amiGetParamExpress ................................................................................................... 92 AmiStatus amiGetParamName ...................................................................................................... 92 AmiStatus amiGetParamUsers ....................................................................................................... 93 AmiStatus amiGetParamValue ...................................................................................................... 93 AmiStatus amiSetParamComment ................................................................................................. 93 AmiStatus amiSetParamExpress .................................................................................................... 93 AmiStatus amiSetParamValue ....................................................................................................... 93 Part Handling ............................................................................................................................. 94 AmiStatus amiCreateEmptyPart .................................................................................................... 94 AmiStatus amiGetActivePart ......................................................................................................... 94 AmiStatus amiGetContainingPart .................................................................................................. 94 AmiStatus amiGetNumPartFeats ................................................................................................... 94
05/12/2001 Page 6
Table of Contents
AmiStatus amiGetPartParams ........................................................................................................ 95 AmiStatus amiGetPartWorkAxes................................................................................................... 95 AmiStatus amiGetPartWorkPlanes ................................................................................................ 95 AmiStatus amiGetPartWorkVertices .............................................................................................. 96 AmiStatus amiGetUnusedSketchesFromPart .................................................................................. 96 AmiStatus amiRollbackPart........................................................................................................... 96
Regeneration Control............................................................................................................... 96
AmiStatus amiRegen ..................................................................................................................... 96 AmiStatus amiRegenAllOfAType.................................................................................................. 97 AmiStatus amiSetNeedsRegen ...................................................................................................... 97
Table of Contents
AmiStatus amiSetData............................................................................................................... 110 AmiStatus amiCreateConstraint ................................................................................................... 111 AmiStatus amiCreateConstraints ................................................................................................. 111 AmiStatus amiCreateConstrDescrip............................................................................................. 111 AmiStatus amiGetConstrDescrip............................................................................................... 112 AmiStatus amiGetConstrOperands .............................................................................................. 112 AmiStatus amiGetConstrParam ................................................................................................... 112 AmiStatus amiGetConstrType ..................................................................................................... 112 AmiStatus amiGetConstrValue .................................................................................................... 112 AmiStatus amiGetDimConstrLoc ................................................................................................ 113 AmiStatus amiSetConstrExpr ...................................................................................................... 113 AmiStatus amiSetConstrValue .................................................................................................... 113 Component Constraint Handling ....................................................................................... 113 AmiStatus amiGetCompsFromConstr .......................................................................................... 113 AmiStatus amiGetConstrsActingOnComp ................................................................................... 113 AmiStatus amiGetConstrsFromComp .......................................................................................... 114 Sketch Handling....................................................................................................................... 114 AmiStatus amiGetBrepGeomFromSketchGeom ........................................................................... 114 AmiStatus amiGetExtSketchConstrs ............................................................................................ 114 AmiStatus amiGetFeatsFromSketch ............................................................................................. 114 AmiStatus amiGetPathStartPoint ................................................................................................. 115 AmiStatus amiGetSketchConstrs ................................................................................................. 115 AmiStatus amiGetSketchCoordSys .............................................................................................. 115 AmiStatus amiGetSketchDefPlane............................................................................................... 115 AmiStatus amiGetSketchesFromGeom ........................................................................................ 116 AmiStatus amiGetSketchGeom ................................................................................................... 116 AmiStatus amiGetSketchParams.................................................................................................. 116 AmiStatus amiGetSketchType ..................................................................................................... 116 Sketch Constraint Handling ................................................................................................ 117 AmiStatus amiGetConstrSketches ............................................................................................... 117 Feature Handling .................................................................................................................... 117 AmiStatus amiAbortCompositeFeat ............................................................................................. 117 AmiStatus amiCreateFeature ....................................................................................................... 117 AmiStatus amiEndCompositeFeat ............................................................................................... 117 AmiStatus amiGetConstrGeomDescrip ........................................................................................ 118 AmiStatus amiGetFeatDepFeats .................................................................................................. 118 AmiStatus amiGetFeatDepWorkGeom ........................................................................................ 118 AmiStatus amiGetFeatEdges ....................................................................................................... 118 AmiStatus amiGetFeatFaces ........................................................................................................ 119 AmiStatus amiGetFeatParams ..................................................................................................... 119 AmiStatus amiGetFeatType ......................................................................................................... 119 AmiStatus amiGetFeatsFromGeom .............................................................................................. 119 AmiStatus amiGetFeatSketch ...................................................................................................... 120 AmiStatus amiGetFeatVertices .................................................................................................... 120 AmiStatus amiGetFeatDescrip ..................................................................................................... 120 AmiStatus amiGetOwningCompositeFeat .................................................................................... 121 AmiStatus amiIsCompToolbody .................................................................................................. 121 AmiStatus amiIsFeatKindOf ........................................................................................................ 121 AmiStatus amiReorderFeat .......................................................................................................... 121 AmiStatus amiSetCompositeFeatEditCallback ............................................................................. 121 AmiStatus amiStartCompositeFeat .............................................................................................. 122 Feature Descriptors ................................................................................................................ 122
05/12/2001 Page 8
Table of Contents
AmiStatus amiCreateFeatDescrip ................................................................................................ 122 AmiStatus amiGetCombinerType ................................................................................................ 122 AmiStatus amiGetDescripType.................................................................................................... 122 AmiStatus amiGetFeatData ......................................................................................................... 123 AmiStatus amiIsDescripKindOf .................................................................................................. 123 AmiStatus amiSetCombinerType ................................................................................................. 123 AmiStatus amiSetFeatPart ........................................................................................................... 123
Table of Contents
05/12/2001 Page 10
Table of Contents
AmiStatus amiSetBendDirection ............................................................................................... 150 AmiStatus amiSetBendProfile ..................................................................................................... 150 AmiStatus amiSetBendRadius ..................................................................................................... 150 AmiStatus amiSetBendSide ......................................................................................................... 150 AmiStatus amiSetBendType ........................................................................................................ 150 Rib Descriptors ........................................................................................................................ 151 AmiStatus amiGetRibData .......................................................................................................... 151 AmiStatus amiSetRibDirection .................................................................................................... 151 AmiStatus amiSetRibProfile ........................................................................................................ 151 AmiStatus amiSetRibThickness ................................................................................................... 151 Pattern Descriptors................................................................................................................. 151 AmiStatus amiGetPatternData ..................................................................................................... 151 AmiStatus amiSetPatternFeatures ................................................................................................ 152 AmiStatus amiSetPatternSuppressedInstances.............................................................................. 152 Axial Pattern Descriptors ..................................................................................................... 152 AmiStatus amiGetAxialPatternData ............................................................................................. 152 AmiStatus amiSetAxialPatternNRevolutions ............................................................................... 153
05/12/2001 Page 11
Table of Contents
AmiStatus amiSetAxialPatternOffsetDirection ............................................................................. 153 AmiStatus amiSetAxialPatternOffsetHeight ................................................................................. 153 AmiStatus amiSetAxialPatternOffsetSpacingType ....................................................................... 153
Table of Contents
AmiStatus amiSetFromToTermData ............................................................................................ 163 AmiStatus amiSetInsideTermData ............................................................................................... 163 AmiStatus amiSetMidPlaneTermData.......................................................................................... 164 AmiStatus amiSetOutsideTermData............................................................................................. 164 AmiStatus amiSetTerminator....................................................................................................... 164 AmiStatus amiSetToFaceTermData ............................................................................................. 164 AmiStatus amiSetToPlaneTermData ............................................................................................ 164
Miscellaneous............................................................................................................................ 170
AmiStatus amiGetDesignMode ................................................................................................... 170 AmiStatus amiGetKeyFromName ................................................................................................ 170 AmiStatus amiSetDesignMode .................................................................................................... 171
Analysis ............................................................................................................................................. 171 AmiStatus amiCheckInterference ................................................................................................ 172 AmiStatus amiCheckInterferenceTrans ........................................................................................ 172 AmiStatus amiGetData ................................................................................................................ 173 AmiStatus amiGetDataArray ....................................................................................................... 173 AmiStatus amiGetDOFDescrip .................................................................................................... 174 AmiStatus amiGetMassProps ...................................................................................................... 174 AmiStatus amiMinDistance ......................................................................................................... 174 Mechanical Desktop Surface Modeling.......................................................................................... 175 Geometry Creation ................................................................................................................. 175 AmiStatus amiCreateSurfFromGeom........................................................................................... 175 AmiStatus amiCreateSurfArrayFromGeom .................................................................................. 175 Drawing Manager ............................................................................................................................ 176 Introduction ................................................................................................................................ 176 Views ........................................................................................................................................... 176 AmiStatus amiAddDataArray ...................................................................................................... 183 AmiStatus amiCreateDwView ..................................................................................................... 183 AmiStatus amiCreateDwVwDescrip ............................................................................................ 184 AmiStatus amiDwEditView ........................................................................................................ 184 AmiStatus amiDwVwDescripIsKindof ........................................................................................ 184 AmiStatus amiFreezeLayers ........................................................................................................ 184 AmiStatus amiGetAllDwVws ...................................................................................................... 184 AmiStatus amiGetData ................................................................................................................ 185 AmiStatus amiGetDataArray ....................................................................................................... 185 AmiStatus amiGetDwVwDescrip ................................................................................................ 186 AmiStatus amiGetDwVwModelObjs ........................................................................................... 186 AmiStatus amiGetDwVwParent .................................................................................................. 186 AmiStatus amiGetNumDwVws ................................................................................................... 186 AmiStatus amiSetData ................................................................................................................ 187
05/12/2001 Page 13
Table of Contents
05/12/2001 Page 14
Table of Contents
05/12/2001 Page 15
Table of Contents
MAISTATICFLAG ..................................................................................................................... 209 MAIUNDEFINEATTCLASS ...................................................................................................... 209 MAIWRITEATTCLASSTOFILE ................................................................................................ 209 MAIWRITEATTCLASSESTOFILE ............................................................................................ 209
Miscellaneous............................................................................................................................ 210
MAIENDEXTERNALEDIT........................................................................................................ 210 MAIGETCURRENTDATABASE ............................................................................................... 210 MAIGETDBIDSFROMKEY ....................................................................................................... 210 MAIGETKEYFROMNAME ....................................................................................................... 210 MAIGETOBJECTSTATE ........................................................................................................... 210 MAIGETDESIGNMODE ........................................................................................................... 210 MAISTARTEXTERNALEDIT.................................................................................................... 210
05/12/2001 Page 16
Table of Contents
MAIGETCOMPDEFCHILDREN ................................................................................................ 214 MAIGETCOMPDEFNAME........................................................................................................ 214 MAIGETMASTERCOMPDEF ................................................................................................... 214 MAIISCOMPDEFEXTERNAL ................................................................................................... 214 MAIISCOMPDEFLEAFNODE ................................................................................................... 215 MAIISCOMPDEFMASTER ....................................................................................................... 215 MAILOCALIZECOMP............................................................................................................... 215 MAIREMOVECOMPFROMCOMPDEF..................................................................................... 215 MAISETACTIVECOMPDEF...................................................................................................... 215 MAISETCOMPDEFNAME ........................................................................................................ 215
Table of Contents
MAIGETSKETCHPLANEFROMSKETCH................................................................................. 219
Table of Contents
Miscellaneous............................................................................................................................ 225
MAIGETDESIGNMODE ........................................................................................................... 225 MAISETDESIGNMODE ............................................................................................................ 225
Analysis....................................................................................................................... 225
MAICHECKINTERFERENCE ................................................................................................... 225 MAIGETDOFDESCRIPDATA ................................................................................................... 226 MAIMINDISTANCE .................................................................................................................. 226
05/12/2001 Page 19
Table of Contents
SmartHole Sample Application................................................................................ 231 Commands.................................................................................................................. 231 SHCreate .................................................................................................................... 231 SHEdit ........................................................................................................................ 231 SHErase ...................................................................................................................... 231 SHMatch..................................................................................................................... 231 SHAudit ...................................................................................................................... 231 Known Issues ............................................................................................................. 231 Hole Projection Sample Application........................................................................ 233
Simple User Interface....................................................................................................................... 233 Known Issues .................................................................................................................................... 233 Methods and Functionality Exercised ............................................................................................ 233 Files.................................................................................................................................................... 234
MfcBrepTrav Sample Application........................................................................... 235 MyBrowser Sample Application .............................................................................. 236 CountAssemblies Sample Application ..................................................................... 237 Which_MDT Sample Application............................................................................ 238
Table of Contents
The Registry Structure .................................................................................................................... 241 Running the Application.................................................................................................................. 241 Guidelines for Building Your Application ..................................................................................... 241
Notes............................................................................................................................ 244
Examples Invoking Mechanical Desktop Commands ................................................................... 244
System Variables........................................................................................................ 245 Integrating the MCAD API with Mechanical Desktop Commands ..................... 247
Calling Mechanical Desktop Commands........................................................................................ 247 Example............................................................................................................................................. 247 Benefits.............................................................................................................................................. 247 Usage Details..................................................................................................................................... 247 Passing Additional Points ................................................................................................................ 248 Sample Code ..................................................................................................................................... 248
REFERENCE: YOUR MOST FREQUENTLY ASKED QUESTIONS ...............................................................................................256 REFERENCE: ALPHABETICAL LISTING OF ENUM TYPES259 REFERENCE: GLOSSARY ................................................................272
Active (leaf node, part) .................................................................................................................... 272 Active Notification............................................................................................................................ 272 API..................................................................................................................................................... 272 Associativity (Attributes)................................................................................................................. 272
05/12/2001 Page 21
Table of Contents
Atomic Locator................................................................................................................................. 272 Attribute............................................................................................................................................ 272 Attribute Class.................................................................................................................................. 272 B-rep.................................................................................................................................................. 272 B-rep API .......................................................................................................................................... 272 Derived Attribute ............................................................................................................................. 273 Feature Descriptor ........................................................................................................................... 273 Filer ................................................................................................................................................... 273 GeLib................................................................................................................................................. 273 Geometry Key................................................................................................................................... 273 Ghost ................................................................................................................................................. 273 Inferred Geometry ........................................................................................................................... 273 Informer ............................................................................................................................................ 273 Instantiable Attribute ...................................................................................................................... 273 Key..................................................................................................................................................... 273 Key Copying ..................................................................................................................................... 273 Leaf Node .......................................................................................................................................... 273 Locator .............................................................................................................................................. 274 Notification ....................................................................................................................................... 274 Object Key ........................................................................................................................................ 274 Owner (Attributes)........................................................................................................................... 274 Passive Notification .......................................................................................................................... 274 Pick Object........................................................................................................................................ 274 Refocus .............................................................................................................................................. 274 Scope.................................................................................................................................................. 274 Terminator........................................................................................................................................ 274 Unused Sketch .................................................................................................................................. 274
05/12/2001 Page 22
Function amiCreateSystemAttribute amiCreateTerminator amiDefineAttClass amiDisableActiveNotification amiDisplayBrowser amiDwAnnotDescripIsKindOf amiDwEditAnnot amiDwEditView amiDwVwDescripIsKindOf amiEditSceneComp amiEnableActiveNotification amiEnableActiveNotification2 amiEndCompositeFeat amiEndExternalEdit amiEraseObject amiEvalParamExpress amiExternalize amiFillPickObj amiFreezeLayers amiGetAbsoluteLocData amiGetActiveAssembly amiGetActiveCompDef amiGetActiveLeafNode amiGetActivePart amiGetAllAttributes amiGetAllCompDefs amiGetAllInstances amiGetAllScenes amiGetAngledLocData amiGetArrayData amiGetAssociatedDoc amiGetAssociatedDbs amiGetAtomLocators amiGetAtomLocData amiGetAtomLocType amiGetAttClasses amiGetAttClassFields amiGetAttClassName amiGetAttField amiGetAttributeHolders amiGetAttributes amiGetAxialPatternData amiGetBaseData amiGetBendData amiGetBlindTermData amiGetBodyFromCompDef amiGetBrepFromKey
Description Creates an MDT system attribute Handles a feature descriptor Handles an instantiable attribute Handles change notification Handles browser display Drawing Manager Drawing Manager Drawing Manager Drawing Manager Handles a scene Handles change notification Handles change notification Handles a feature Handles external editing Erases an object Handles a parameter Handles a component definition Creates a pick object Handles a view Handles a feature descriptor Handles a component Handles a component definition Handles a component Queries a part Handles attributes Handles a component definition Handles a component definition Handles scenes Handles a feature descriptor Queries a feature Queries associated documents Handles a key Queries a feature Queries a feature Queries a feature Handles an instantiable attribute Handles an instantiable attribute Handles an instantiable attribute Handles an instantiable attribute Handles attributes Handles attributes Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Queries a feature Queries a component definition B-rep API integration
Page 85 161 81 77 196 189 189 184 189 192 77 77 117 85 85 91 100 68 184 157 104 100 104 94 79 100 100 192 157 135 86 73 157 158 158 81 81 82 82 80 80 152 128 149 161 101 78
05/12/2001 Page 24
Function amiGetBrepGeomFromSketchGeom amiGetCBoreHoleData amiGetChamferData amiGetColorOverride amiGetCombinerType amiGetCompChildren amiGetCompDef amiGetCompDefChildren amiGetCompDefName amiGetCompInDef amiGetCompName amiGetCompositeFeatData amiGetCompOwner amiGetCompPosition amiGetCompsFromConstr amiGetConstrDescrip amiGetConstrGeomData amiGetConstrGeomDescrip amiGetConstrOperands amiGetConstrParam amiGetConstrsActingOnComp amiGetConstrsFromComp amiGetConstrSketches amiGetConstrType amiGetConstrValue amiGetContainingComp amiGetContainingPart amiGetCoordSysLocData amiGetCSinkHoleData amiGetCubicFilletData amiGetCurrentDatabase amiGetCurrentSketchPlane amiGetCurrentVersion amiGetCustomAHL amiGetData amiGetData amiGetData amiGetData amiGetData amiGetData amiGetData amiGetData amiGetDataArray amiGetDataArray amiGetDbIdsFromKey amiGetDescripType amiGetDesignMode
Description Handles sketch geometry Queries a feature Queries a feature Handles object color Queries a feature Handles a component Handles a component Handles a component definition Handles a component Handles a component Handles a component Handles a feature Handles a component Handles a component Handles a constraint Handles a constraint Handles a feature descriptor Handles a feature Handles a constraint Queries a constraint Handles a component Handles a constraint Handles a sketch constraint Handles a constraint Handles a constraint Handles a component Queries a part Handles a feature descriptor Queries a feature Queries a feature Queries the current database Handles a sketch Table-Driven Versions API Handles hidden line calculations Handles a constraint Handles an event Performs analysis Drawing Manager Drawing Manager Handles a scene Handles a file descriptor Handles a sketch descriptor Performs analysis Drawing Manager Database integration Queries a feature Queries design mode
Page 114 124 130 85 122 104 104 101 101 105 105 123 105 105 113 112 140 118 112 112 113 114 117 112 112 106 94 158 125 132 86 148 164 195 109 169 173 191 187 192 198 146 173 185 86 122 170
05/12/2001 Page 25
Function amiGetDimConstrLoc amiGetDistFromLocData amiGetDOFDescrip amiGetDraftData amiGetDwAnnotDescrip amiGetDwAnnotView amiGetDwVwAnnots amiGetDwVwDescrip amiGetDwVwModelObjs amiGetDwVwParent amiGetEdgeDraftData amiGetExecVersion amiGetExtrusionData amiGetExtSketchConstrs amiGetFaceSplitData amiGetFeatEdges amiGetFeatFaces amiGetFeatData amiGetFeatDepFeats amiGetFeatDepWorkGeom amiGetFeatDescrip amiGetFeatParams amiGetFeatsFromGeom amiGetFeatsFromSketch amiGetFeatSketch amiGetFeatType amiGetFeatVertices amiGetFile amiGetFileVersion amiGetFixedFilletData amiGetFromToTermData amiGetGeomData amiGetGeomKey amiGetGlobalParams amiGetHoleData amiGetHoleTapData amiGetIndFilletData amiGetInferGeom amiGetInsideTermData amiGetKeyFromBrep amiGetKeyFromId amiGetKeyFromName amiGetKeyFromPath amiGetKeyFromPick amiGetKeyType amiGetLinearFilletData amiGetLinkInfo
Description Handles a constraint Queries a feature Handles DOF descriptor Handles a feature descriptor Drawing Manager Drawing Manager Drawing Manager Drawing Manager Drawing Manager Drawing Manager Handles a feature descriptor Queries a feature Queries a feature Queries a sketch Handles a split descriptor Queries a feature Queries a feature Handles a feature descriptor Handles a feature Handles a feature Queries a feature Queries a feature Queries a feature Queries a sketch Queries a feature Queries a feature Queries a feature Handles file descriptors Queries a feature Queries a feature Queries a feature Handles geometry Creates a geometric key Queries a parameter Queries a feature Queries a feature Queries a feature Creates a key Queries a feature B-rep API integration Creates a key Creates a key Creates a key Creates a key Handles a key Queries a feature Table-Driven Versions API
Page 113 158 174 142 190 190 190 186 186 186 142 86 128 114 144 118 119 123 118 118 120 119 119 114 120 119 120 198 86 79 161 76 71 91 125 125 132 69 162 79 70 170 70 71 73 133 165
05/12/2001 Page 26
Function amiGetLocator amiGetLoftData amiGetMassProps amiGetMasterCompDef amiGetMidPlaneTermData amiGetNumDwVws amiGetNumPartFeats amiGetObjectName amiGetObjectState amiGetObjectVisibility amiGetOffsetLocData amiGetOnPlaneLocData amiGetOutsideTermData AmiGetOwningCompositeFeat amiGetParamComment amiGetParamDeps amiGetParametricBoolData amiGetParamExpress amiGetParamName amiGetParamUsers amiGetParamValue amiGetPartDefinition amiGetPartFeats amiGetPartParams amiGetPartSplitData amiGetPartWorkAxes amiGetPartWorkPlanes amiGetPartWorkVertices amiGetPathStartPoint amiGetPatternData amiGetPickInfo amiGetPlaneDraftData amiGetPolarArrayData amiGetPolarPatternData amiGetRecArrayData amiGetRectangularPatternData amiGetRevolveData amiGetRibData amiGetSceneCompDef amiGetSceneCompDescrip amiGetSceneExplodeFactor amiGetSceneLock amiGetShadowDraftData amiGetShellData amiGetSketchConstrs amiGetSketchCoordSys amiGetSketchDefPlane
Description Queries a feature Handles a feature descriptor Performs analysis Handles a component definition Queries a feature Drawing Manager Queries a part Queries an object name Queries an objects state Queries an objects visibility Handles a feature descriptor Handles a feature descriptor Queries a feature Handles a composite feature Handles a parameter Queries a parameter Handles a feature descriptor Gets a parameter Queries a parameter Queries a parameter Queries a parameter Handles a component definition Queries a part Queries a part Handles a split descriptor Queries a part Queries a part Queries a part Handles a sketch Handles a feature descriptor Queries a pick object Handles a feature descriptor Queries a feature Handles a feature descriptor Queries a feature Handles a feature descriptor Queries a feature Handles a feature descriptor Handles a scene Handles a scene Handles a scene Handles a scene Handles a feature descriptor Queries a feature Queries a sketch Queries a sketch Queries a sketch
Page 158 140 174 101 162 186 94 86 86 87 159 159 162 121 92 92 139 92 92 93 93 102 94 95 144 95 95 96 115 151 68 142 135 153 136 155 130 151 193 193 193 193 143 138 115 115 115
05/12/2001 Page 27
Function amiGetSketchedSplineSegments amiGetSketchesFromGeom amiGetSketchGeom amiGetSketchParams amiGetSketchPlaneDescrip amiGetSketchPlaneFromSketch amiGetSketchType amiGetSurfCutData amiGetSystemAttributeName amiGetSweepData amiGetSysVar amiGetTangentLocData amiGetTerminator amiGetTermType amiGetThinExtrusionData amiGetToFaceTermData amiGetToPlaneTermData amiGetUniFilletData amiGetUnusedSketchesFromPart amiGetWorkPlaneData amiHasColorOverride amiHighlight amiInferGeomKey amiIsBrowserDisplayed amiIsArrayInstanceIndependent amiIsCompDefExternal amiIsCompDefLeafNode amiIsCompDefMaster amiIsCompToolbody amiIsDescripKindOf amiIsDirectlyEditable amiIsFeatKindOf amiIsFeatSuppressed amiIsKeyKindOf amiIsKeyNull amiIsPDMRegistered amiLineIsSilhouette amiLocalize amiMakeInstAtt amiMinDistance amiMoveDwAnnot amiObjectHasChanged amiObjectWasErased amiPick amiReactDescrip::make amiReadAttClassesFromFile
Description Handles geometry Queries a sketch Queries a sketch Queries a sketch Handles a sketch plane Handles a sketch plane Queries a sketch Queries a feature Queries the name of a specified system attribute Queries a feature Queries a system variable Handles a feature descriptor Queries a feature Queries a feature Queries a feature Queries a feature Queries a feature Queries a feature Queries a part Handles a feature descriptor Handles object color Controls entity highlighting Creates a key Handles browser display Handles an array descriptor Handles a component definition Handles a component Handles a component definition Handles a feature Queries a feature Handles objects Queries a feature Controls suppression Handles a key Handles a key Handles file descriptors Handles geometry Handles a component definition Handles an instantiable attribute Handles analysis Drawing Manager Handles change notification Handles change notification Creates a pick object Event handling Handles an instantiable attribute
Page 76 116 116 116 148 148 116 138 88 134 88 159 162 162 129 163 163 133 95 140 88 75 71 196 149 102 102 102 121 123 89 121 97 73 74 198 76 103 83 174 190 78 78 69 166 83
05/12/2001 Page 28
Function amiReadKey amiReassignComps amiRefocusKey amiRegen amiRegenAllOfAType amiRegisterApp amiRegisterEventReaction amiRemoveAttribute amiRemoveColorOverride amiRemoveEventReaction amiRemoveBrowserTab amiRemoveCompFromCompDef amiRemoveFile amiRemoveLink amiReorderFeat amiRollbackPart amiSetAbsoluteLocData amiSetActiveAssembly amiSetActiveCompDef amiSetActiveLeafNode amiSetAngledLocData amiSetArrayFeature amiSetAtomLocData amiSetAttField amiSetAxialPatternNRevolutions amiSetAxialPatternOffsetDirection amiSetAxialPatternOffsetHeight amiSetAxialPatternOffsetSpacingType amiSetBaseData amiSetBendAngle amiSetBendArcLen amiSetBendDirection amiSetBendProfile amiSetBendRadius amiSetBendSide amiSetBendType amiSetBlindTermData amiSetCBoreHoleCbDepth amiSetCBoreHoleCbDiam amiSetChamferAngle amiSetChamferAngleFace amiSetChamferDist1 amiSetChamferDist1Face amiSetChamferDist2 amiSetChamferEdges amiSetChamferType amiSetCombinerType
Description Handles a key Handles a component definition Handles a key Controls regeneration Controls regeneration Event handling Event handling Handles attributes Handles object color Event Handling Manipulates a user interface Handles a component definition Handles file descriptors Table-Driven Versions API Handles a feature Handles a part Handles a feature descriptor Handles a component Handles a component definition Handles a component definition Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles an instantiable attribute Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor
Page 74 103 74 96 97 169 169 81 89 170 197 103 198 165 121 96 159 106 106 174 159 136 160 83 153 153 153 153 128 149 150 150 150 150 150 150 163 126 126 131 131 131 131 131 132 132 123
05/12/2001 Page 29
Function amiSetCompDefName amiSetCompName amiSetCompositeFeatDrivingParams amiSetCompositeFeatEditCallback amiSetCompositeFeatOwnerInfo amiSetCompositeFeatType amiSetCompPosition amiSetConstrExpr amiSetConstrValue amiSetCoordSysLocData amiSetCSinkHoleCsAngle amiSetCSinkHoleCsDiam amiSetCubicFilletRadii amiSetCurrentVersion amiSetCustomAHL amiSetData amiSetData amiSetData amiSetData amiSetData amiSetData amiSetData amiSetData amiSetDesignMode amiSetDistFromLocData amiSetDraftAngle amiSetDraftPlane amiSetDraftTangents amiSetDwAnnotData amiSetDwVwData amiSetDwVwDataArray amiSetEdgeDraftFaces amiSetExtrusionDirectionVec amiSetExtrusionDraftAngle amiSetExtrusionProfile amiSetFaceSplitFaces amiSetFeatPart amiSetFilletEdges amiSetFixedFilletChordLength amiSetFromToTermData amiSetGeometry amiSetHoleDiameter amiSetHoleDirectionVec amiSetHoleDrillAngle amiSetHoleFitClass amiSetHoleNominalSize amiSetHolePitch
Description Handles a component definition Handles a component Handles a feature descriptor Handles a composite feature Handles a feature descriptor Handles a feature descriptor Handles a component Handles a constraint Handles a constraint Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Table-Driven Versions API Handles hidden line calculations Handles a constraint Handles a sketch descriptor Handles a file descriptor Handles an event Drawing Manager Drawing Manager Handles a scene Handles a feature descriptor Handles design mode Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Drawing Manager Drawing Manager Drawing Manager Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a split descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles geometry Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor
Page 104 106 124 121 124 124 107 113 113 160 126 126 133 165 195 110 146 148 170 187 191 193 170 171 160 143 143 143 191 187 187 143 129 129 129 145 123 133 133 163 77 126 126 126 127 127 127
05/12/2001 Page 30
Function amiSetHoleTapData amiSetHoleTapDrillDiameter amiSetHoleUnits amiSetIndFilletRadii amiSetInsideTermData amiSetLinearFilletRadii amiSetLocator amiSetLoftAngles amiSetLoftMinimizeTwist amiSetLoftType amiSetLoftXSections amiSetMidPlaneTermData amiSetObjectName amiSetObjectVisibility amiSetOffsetLocData amiSetOnPlaneLocData amiSetOutsideTermData amiSetParamComment amiSetParametricBoolComp amiSetParamExpress amiSetParamValue amiSetPartSplitFlip amiSetPartSplitName amiSetPatternFeatures amiSetPatternSuppressedInstances amiSetPlaneDraftFaces amiSetPolarArrayAngle amiSetPolarArrayNumInstances amiSetPolarArrayPolarAngleType amiSetPolarArrayRotateAsCopied amiSetPolarPatternAngle amiSetPolarPatternNInstances amiSetPolarPatternOrientation amiSetPolarPatternRotationDirection amiSetRecArrayColData amiSetRecArrayRowData amiSetRecArrayXVector amiSetRecArrayYVector amiSetRectangularPatternAlignmentAngle amiSetRectangularPatternColumnData amiSetRectangularPatternColumnDirection amiSetRectangularPatternRowData amiSetRectangularPatternRowDirection amiSetRectangularPatternSketchPlane amiSetRevolveAxis amiSetRevolveDirectionVec amiSetRevolveProfile
Description Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Sets an object name Sets an objects visibility Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Sets a parameter Handles a feature descriptor Sets a parameter Edits a parameter Handles a split descriptor Handles a split descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor
Page 127 127 128 134 163 134 160 141 141 141 142 164 89 89 159 161 164 93 139 93 93 145 145 152 152 144 136 136 137 137 154 154 154 154 137 137 137 137 155 155 156 156 156 156 130 130 130
05/12/2001 Page 31
Function amiSetRibDirection amiSetRibProfile amiSetRibThickness amiSetSceneLock amiSetShadowDraftFaces amiSetShellExcludes amiSetShellOverrides amiSetSplitCombinerPartName amiSetPatternSuppressedInstances amiSetSurfCutDirectionVec amiSetSurfCutSurf amiSetSweepDraftAngle amiSetSweepMethod amiSetSweepPath amiSetSweepProfile amiSetSystemAttributeName amiSetSysVar amiSetTangentLocData amiSetTerminator amiSetThinExtrusionExtend amiSetThinExtrusionThickness amiSetToFaceTermData amiSetToPlaneTermData amiSetUniFilletRadius amiStartCompositeFeat amiStartExternalEdit amiSuppressFeat amiSuppressFeatsByType amiThawLayers amiUndefineAttClass amiUnsuppressFeat amiUnsuppressFeatsByType amiUnsuppressPartFeats amiWriteAttClassesToFile amiWriteAttClassToFile amiWriteKey
Description Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a scene Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles an MDT system attribute name Handles a system variable Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature descriptor Handles a feature Handles external file edits Controls suppression Controls suppression Handles a view Handles an instantiable attribute Controls suppression Controls suppression Controls suppression Handles an instantiable attribute Handles an instantiable attribute Handles a key
Page 151 151 151 194 144 139 139 145 152 138 138 134 135 135 135 90 90 161 164 129 129 164 164 134 122 90 97 97 188 84 98 98 98 84 84 75
05/12/2001 Page 32
List of Tables
Below is a list of tables in this document, along with the page number on which it is found. Table Name
Constraint Attribute Keywords Constraint Attribute Keywords - Assembly Constraints Constraint Attribute Keywords - Sketch Constraints Constraint Attribute Keywords - Sketch Dimensions Event Reaction Attributes Sketch Attribute Keywords Event Keywords Callback Function Pointer Typedefs : Degrees of Freedom Attribute Keywords View Attribute Keywords View Attributes: kBaseVw View Attributes: kOrthoVw View: kIsoVw View Attributes: kDetVw View Attributes: kAuxVw View: kBrokenVw Drawing Manager View Section Types Annotation Attribute Keywords Scene-Comp Attribute Keywords File Attribute Keywords File Attribute Keywords - continued
Page
107 107 107 107 107 146 166 168 171 176 179 180 180 180 181 181 182 188 191 199 200
05/12/2001 Page 33
Chapter 1 Overview
This document introduces the Autodesk Mechanical Application Programming Interface (MCAD API), an application development tool for creating associative mechanical applications. The MCAD API enhances and extends the ObjectARX development environment. Autodesk mechanical applications have quickly become the desktop standard mechanical design automation platform with hundreds of thousands of users worldwide. The MCAD API provides a high level of direct access to AutoCAD mechanical data objects and is intended to support the development of a broad base of interoperable design automation, manufacturing and visualization products. With this API, third-party developers can create applications that feature parametric editing and associativityrequirements that have become baseline features in todays modern mechanical CAD marketplace. Using the MCAD API, developers of mechanical applications have more time to focus on higher level modeling techniques and new modeling and analysis paradigms. The MCAD API program creates opportunities for developers to create and market applications in the following areas (among others): = = = = = = = = = = = = Manufacturing and tooling, driven by free-form surface or solid models Structural and plastic molding analysis Finite element analysis with associative mesh and boundary conditions Design productivity tools, such as symbol libraries or parametric mechanical features Tolerance analysis Parametric content distribution Form feature toolkit through user-defined features Sheet metal design Assembly modeling extensions, BOM enhancement, and SQL links Kinematic or fully dynamic analysis Bill of materials input/output Electronic PCB geometry interface
API Goals
Applications communicate through a common compiled-language interface, so a high level of integration is achieved between third-party applications and the Mechanical Desktop. From the developers point of view, integrated applications eliminate the time-consuming and often inaccurate task of translating data. Developers can improve the functionality of their designs, bring products to market faster, and make their products more attractive to the large AutoCAD user base.
05/12/2001 Page 34
Overview
...
FEM FEM
NC NC
Mechanical Desktop
AutoCAD Database
The MCAD API puts programmatic access to the Mechanical Desktop and AutoCAD under one common layer. The MCAD API provides access not only to multiple modeling paradigms and unrestricted modeling environments (manifold solids and surface modeling), but also a unified access mechanism for AutoCAD and Mechanical Desktop geometry. This mechanism, geometric keys, allow uniform references to all types of model geometry, including: wireframe, surface, solid and parametric part geometry; geometry that is in the local database or in an external database; geometry that is on the model or that is inferred from existing geometry, etc. Extensive mechanisms for attribute creation, attachment and editing are provided. Users of the API have full access to all the data defining parts, assemblies, drawing views and tables used, as well as a comprehensive suite of modeling event notifications and the possibility of customizing the browser and the appearance of components in drawing views.
AcBr Library
This library is the interface to query topological information from a geometric item, when that information is present. AutoCAD solid models and Mechanical Desktop part models are B-rep solids, which consist of a collection of topological and geometric entities. The MCAD API interacts with the boundary representation query library, AcBr, to access topological and geometric data. From a geometry key a B-rep entity can be returned, initialized to that location. The entity can then be used to traverse the B-rep to get connectivity information and to create new keys. The following solid entities can be queried without a geometry key just by using methods in the AcBr library:
05/12/2001 Page 35
Overview
= = =
The AcBr library transfers read-only data about a model into your application for display, analysis, or manipulation. It locates particular features of interest in the model and queries them for information, such as their geometry and connectivity.
AcGe Library
The MCAD API interacts with the Geometry Library to retrieve geometry. The AcGe library consists of utility classes for performing common 2D and 3D algebra, such as vectors and matrices. It provides geometric objects such as points, curves, and surfaces. AcGe objects returned by the MCAD API are copies of application objects that are returned by geometry queries. Additional AcGe objects can also be directly created by the library user. AcGe objects are taken in as the data specification in geometric editing functions. The AcGe library supports geometry query and manipulation.
ObjectARX Libraries
ObjectARX libraries offer the following general functionality: = = = Creating menus and registering commands Handling user input/output System queries, database operations, and graphics display
Please note that you cannot open a Mechanical Desktop file from the Mechanical Desktop using ObjectARX.
Supported Platforms
Applications may be developed for Windows 98, Windows NT, Windows 2000 and Windows Me.
05/12/2001 Page 36
All Mechanical Desktop modules subscribe to the same API, so the breadth of third-party applications can be increased in an automatic, transparent manner without being recompiled by the third-party developer. Today, for example, Mechanical Desktop surface geometry cannot be constrained. The MCAD API offers methods that deal with geometrical constraints, but at this time these methods are effective only when the parametric part modeler owns the geometry. In the future, the Mechanical Desktop might support constrained surface geometry. If and when that happens, the calls in the API that handle constraints will be honored by the Desktop. Third-party applications that made use of these calls and used to work only on parametric solid models will automatically start to work on Mechanical Desktop surface models as well.
05/12/2001 Page 37
Overview
Attribute Support
The MCAD API supports attribute creation, customization, attachment, query, and edits. In addition, attributes that are attached to entities in a parametric model remain attached across parametric regenerations even though the actual model entity is deleted and recreated in the process. This functionality is very important for a variety of applications that need to attach attributes to parts of the underlying model. Custom attribute classes can be created and managed using the MCAD API.
05/12/2001 Page 38
Overview
Object Keys
Third-party applications use keys to refer to application objects. Keys are persistent and uniform across applications. All the necessary information to resolve the key to the referred application object is stored in the key. An application identifier that allows the system to quickly identify which application manages the key is also stored in the key. When a key is passed to an MCAD API function, the system knows what application created the key, so it can route the call to the proper piece of code. Keys are C++ objects grouped in a terse hierarchy that provides users with type checking and hierarchical characterization. Because the MCAD API uses a functional interface to export functionality, methods are not present in the object key hierarchy. Keys are passed and returned as arguments of API functions. This approach insulates users from changes in the MCAD API implementations that might cause applications to break. The functions fully use the key hierarchical characterization, so that at compile time inappropriate key types cannot be passed into the function.
AmiConeKey
AmiCompDefKey
AmiCylinderKey
AmiDwVwKey
AmiSphereKey
AmiAnnotKey
AmiTorusKey
AmiSceneKey
AmiSplineSrfKey
05/12/2001 Page 39
Overview
key classes curve key classes geometric key classes surface key classes body key classes
Refers to a
AmiConstrKey constraint AmiParamKey parameter AmiSketchKey sketch AmiFeatKey feature AmiPartKey part AmiSolidKey AutoCAD solid AmiSketchConstrKey sketch constraint AmiCompConstrKey component constraint AmiCompDefKey component definition AmiCompKey component AmiPointKey point AmiVectorKey vector AmiLineKey line AmiArcKey full or partial circular arc AmiSplineCurveKey spline curve AmiEllipseKey full or partial elliptical arc AmiPolylineKey polyline AmiAugLineKey augmented line* AmiPlaneKey plane AmiConeKey cone AmiCylinderKey cylinder AmiSphereKey sphere AmiTorusKey torus AmiSplineSrfKey spline surface AmiDwVwKey drawing view amiDwAnnotKey drawing annotation amiSceneKey scene * A polyline with a vector associated with each vertex API users do not need to be concerned with the internal information stored in the key, what application created it, or how to handle the key. API functions construct a key, check if a key is null, save and restore a key, and release the key. The following paradigm is normally followed by the MCAD API user in working with keys: 1. 2. 3. 4. 5. Obtain an object key to a mechanical application object by calling appropriate API functions. Use the key to identify the object when calling functions in the MCAD API. Check the status returned by functions. Save or restore the key if necessary. Release the key when it is no longer needed.
05/12/2001 Page 40
Overview
Summary
The following points highlight some key features of the MCAD API architecture: = = = = = = The MCAD API is based on a flexible architecture that is designed to be extensible. Object keys are used in most interactions between the client application and the MCAD API. Most API functions delegate processing to different Mechanical Desktop modules such as part, assembly or surface API implementation modules. The MCAD API uses information in the object keys to determine how to delegate the processing. Some API functions, such as the selection and highlighting utilities, interface directly with AutoCAD. The modular design allows Autodesk to ship updates of the API modules as well as the Mechanical Desktop without affecting released 3rd party applications.
05/12/2001 Page 41
Overview
= Future Mechanical Desktop modulescan be easily integrated into the existing MCAD API architecture. Existing client applications of the MCAD API are automatically supported by the new Mechanical Desktop modules
05/12/2001 Page 42
On the other hand, if you decide to use the general instantiable attribute class provided by the MCAD API, your attribute objects that have been saved to a DWG file can be accessed without the application that originally created the attribute being present. In this scenario you can increase the interoperability of your attribute objects, but you forgo the possibility of customizing the attribute implementation. Using instantiable attributes also saves you time because you dont have to provide an implementation for your attribute class.
Attribute Management
Attributes attached to an entity must be properly managed when that entity is copied, exported to another database or imported from another database. There are two ways to control how attributes are managed: attribute ownership, which is specified when the attribute is created, and attribute associativity, which is specified when an attribute is attached to an entity.
Attribute Ownership
The attribute owner is specified when the attribute is created and cannot be changed during the lifetime of the attribute. Either the MCAD API owns and controls the attribute, or the application does. When the MCAD API manages the attribute, it ensures that the attribute is cloned, exported or imported along with the entity to which it is attached. If the API is not the owner, then the application is responsible for triggering a clone of the attribute and ensuring that the owner of the attribute is appropriately cloned as well. Instantiable attribute objects are always owned by the MCAD API, but instances of custom attribute classes can be set to be owned by the API on an instance-by-instance basis. If the attribute is not owned by the MCAD API, the attribute can be ignored automatically, but the copy behavior depends on the owning application. If the application is not properly cloning the attributes it controls, then after a copy the attribute will be shared. If the entity is exported (using the AutoCAD WBLOCK command) then the attribute will be dropped, because the API can no longer access the object that owns the attribute and therefore cannot clone the attribute.
Attribute Associativity
The associativity of an attribute is specified when the attribute is attached to a specific object. It controls what should happen to the attachment of this particular attribute when the object is copied, exported or imported. The current options are copy, share, or ignore for all actions. Copy means to copy the attribute and attach the new copy to the new object. Share means to attach the original attribute to the new object. Ignore means dont include this attribute on the new object. More precise control over attribute behavior (for example, the option to share during an internal copy but ignore when exporting) is planned for future releases of the MCAD API.
Public Methods
virtual AmiStatus getOwningApp ( const char*& appName ) const
05/12/2001 Page 44
appName
Application name.
attributeName
Attribute name.
numFields
index
Output
fieldName
Gets a string that gives a description of the meaning of the specified field.
Input
index
Output
Index for the desired field (starts at zero). Description of field meaning.
fieldDesc
index
Output
Index for the desired field (starts at zero). Type of the data contained in the field.
type
Gets the data stored in the specified field by giving the caller a pointer to the data location.
Input
index
Output
Index for the desired field (starts at zero). Pointer to data location for the field.
pContent
Sets the data stored in the specified field by giving the caller a pointer to the data location from where to copy the new data.
Input
index
Output
05/12/2001 Page 45
pContent
Pointer to data location for the data to be used in updating the field.
Applications defining their own attribute classes must implement these methods. Pointers set by any of the public methods are assumed to point to memory that does not need to be freed by the caller. Privacy of some of the fields in an attribute can be obtained by not including them in the set of fields that can be accessed through the query methods defined by AmiAttribute. Thus, if an attribute class holds on to three public attributes and two private ones, getNumFields could be implemented to return 3 as the number of fields in the attribute and valid field indices for the other methods would be 0, 1, and 2 only.
The first argument is the system attribute name. Any system attribute attached to a component definition must be named and that name must be unique within the component definition. The second argument is the data type for the single field. Valid types are Ami::kString, Ami::kLong, and Ami::kDouble. The third argument is an attribute pointer that will be filled in by the function assuming the call is successful. Once an attribute is created using this function, it can be attached to the component definition by calling amiAddAttribute on the component definition key. There are two additional functions that were added for working with system attributes. As was mentioned previously, system attribute must have unique names within their component definition. Although the name is specified at the time the attribute is created, additional functions have been added to allow the name to be changed on an existing attribute and also for the name to be queried.
05/12/2001 Page 46
AmiStatus amiSetSystemAttributeName(AmiAttribute* pAttrib, const char* pName); AmiStatus amiGetSystemAttributeName(AmiAttribute* pAttrib, std::string& name);
Notation
The word class in double quotes is used to indicate an MCAD API run-time class as opposed to a C++ class.
Problem
An application can define its own attribute class by deriving from the abstract class AmiAttribute, implementing the custom methods required for that attribute class, and implementing the virtual functions in the base class. These attributes can be saved in the DWG file; however, if one of these attributes is read and the application that defined this attribute is not loaded, the attribute will be a proxy.
Instantiable Attributes
The instantiable attribute class is maintained by the MCAD API and can be used by all client applications regardless of whether the defining application is loaded or not. This new attribute class has the following characteristics: = Attribute objects contain an arbitrary number of fields of different types. = Attribute objects can be exchanged freely through DWG files regardless of whether or not the application that defined the attribute is loaded at the time the attribute is accessed. = An application will be able to instantiate an attribute whose class was defined by another application that may not currently be loaded. = Attribute classes can be defined at runtime. = The application defining a new attribute class does not need to implement any methods for the new class. = Static data can be defined for a given attribute class. Such data is shared by all instances of that class. = Efficient data access time and small memory footprint for each instance are provided.
05/12/2001 Page 47
To define an instantiable attribute class, an array of these field structures are filled in, one for each field, and passed into a new MCAD API function, which is prototyped as follows:
amiDefineAttClass(const char* className, int nFields, const AmiAttFieldDesc* pFields);
When this function is called, a class record is created and maintained by the system. This does not necessarily mean that the class record is saved into the DWG file. The record only exists in memory until an instance of the described attribute is created. At that time, a copy of the class record is put into the database. Each subsequent creation of an instance of the described attribute references the same class record and increments a reference count within the record of how many instances are in the current database. Conversely, as attribute instances are erased from the database, the reference count in the record is decremented. If and when that reference count reaches zero, the class record is erased from the database. At this point, the in-memory record still exists so new instances of the attribute can still be created without having to re-register the attribute class. The in-memory record lasts for the length of the session.
Example
As an example of how to define an instantiable attribute, suppose you want to attach a material attribute to a displayable object to control how the object looks when it is rendered. The following is a code snippet showing how that can be done.
AmiAttFieldDesc fields[4]; fields[0].mFieldName fields[0].mFieldDesc fields[0].mFieldType fields[0].mStaticFlag fields[1].mFieldName fields[1].mFieldDesc fields[1].mFieldType fields[1].mStaticFlag fields[2].mFieldName fields[2].mFieldDesc fields[2].mFieldType fields[2].mStaticFlag fields[3].mFieldName fields[3].mFieldDesc fields[3].mFieldType fields[3].mStaticFlag = = = = = = = = = = = = = = = = ambient; Ambient Coefficient; kAmiDouble; FALSE; diffuse; Diffuse Coefficient; kAmiDouble; FALSE; specular; Specular Coefficient; kAmiDouble; FALSE; exponent; Specular Exponent; kAmiLong; FALSE;
05/12/2001 Page 48
Example
An attribute definition file containing only a material attribute would look as follows:
1 material 4 ambient Ambient Coefficient double FALSE FALSE diffuse Diffuse Coefficient double FALSE FALSE specular Specular Coefficient double FALSE FALSE exponent Specular Exponent long FALSE FALSE
05/12/2001 Page 49
In this example, the MCAD API function amiMakeInstAtt is called to create an instance of the instantiable attribute whose class name is material. Once the instance is successfully created, the MCAD API function amiSetAttFieldDouble is called to set the double value on the material attribute fields. The MCAD API contains several functions for setting and getting field values based on the field type. See the Function Reference section for a complete listing of these functions.
Transactions
In the previous sections example of creating an attribute instance, a pointer to the newly created instance is returned from the function amiMakeInstAtt. This pointer will only be valid if there is an open database transaction when the create function is called. When an API function returns a pointer to an attribute, you need to make sure there is a database transaction open during the entire time you are working with the pointer. If these functions are called within the scope of ObjectARX commands (as they are in the sample app), then a transaction will already be open. If the functions are called in another scope, however (such as an event handling function of a modeless dialog box), then care must be taken to make sure that a transaction is opened and stays open as long as use of the returned pointer is required. This can be done via the transaction manager methods startTransaction and endTransaction.
Standard Attributes
Another benefit of the instantiable attributes mechanism is the ability of third parties and Autodesk to supply libraries of standard attribute definitions. Instead of having several applications defining attributes for things like material properties, an instantiable attribute definition can be agreed upon and the definition could be added to the MCAD API. These standard definitions will be available in future releases.
Function Reference
The functionality provided by the set of classes that constitute the instantiable attribute subsystem is exported in a functional form in the MCAD API. The functions are grouped in related groups as follows.
05/12/2001 Page 50
By Field Name:
amiGetAttField(AmiInstAtt* pAtt, const char* fieldname, <input Type> value); amiSetAttField(AmiInstAtt* pAtt, const char* fieldName, <input Type> value);
By Index:
amiGetAttField(AmiInstAtt* pAtt, int index, <input Type> value); amiSetAttField(AmiInstAtt* pAtt, int index, <input Type> value);
05/12/2001 Page 51
In addition to being overloaded on the return type, these get/set functions are overloaded on the descriptor type. Thus, the same function names are used for getting/setting attribute values in descriptors for views, annotation, scene components, files, etc. Those functions are amiGetData(), amiSetData(), amiGetDataArray(), and amiSetDataArray(). The separate versions for the various descriptor types are described separately in the appropriate sub-sections in Chapter 3 (MCAD API FunctionsDetailed Description of Functions).
Some attributes are read-only. Typically, the values for read-only attributes can be altered within a descriptor, but when that descriptor is applied to a database object the value must match the setting already stored in the database. Thus, these attributes are read-only with respect to database and not with respect to descriptors. Other attributes are write-once, meaning that they can be written to the database when a descriptor is used to create a new database object, but they cannot be used to edit the state of an existing database object. There is a special value that can be used for any attribute in any descriptor. This value is not a legitimate value in the domain of any of the data types for any of the attributes it is Ami::attNAV and stands for Not A Value. If any attributes in the descriptor are set to Ami::attNAV, then those attributes wont be applied to the database when the descriptor is used in an edit operation on a key (e.g. amiDwEditView). These NAV values will be skipped this is not an error condition and the return status is eOk. Thus, NAV can be used as a dont care condition when applying AmiDescrip descriptors to keys. If any read-only attributes in the descriptor have a value that differs from the value already in affect for the given key, and if that attribute is not NAV, then the edit operation on the key will return an error status (the status is eAttReadOnly). Some attributes are mandatory attributes and must have a non-NAV value when a descriptor is used to create a new database object. An empty descriptor is a descriptor where all values are NAV. Using an empty descriptor to edit an object referenced by a key has no effect on the object (all of the values are dont care). This semantics for NAV and editing operations makes it possible to use a partially set descriptor in an editing operation on a key to set a small number of attributes while leaving the others unchanged. Similarly, you can obtain a descriptor from a key, alter one or two of the attribute values, apply the descriptor to the same key, and the altered settings will be applied while the others remain unaffected.
05/12/2001 Page 52
AmiValue
Once a descriptor is obtained, it can be used in a handful of new API functions to query for information about the descriptor. Numeric information is returned in the form of AmiValue objects.
AmiFeatKey *pKey; Assume this is a key to a hole. AmiFeatDescrip *pDescrip; AmiStatus stat; stat = amiGetFeatDescrip(pKey, pDescrip, Adesk::kTrue, Adesk::kFalse); Adesk::Boolean isHole; amiIsDescripKindOf(pDescrip, Ami::kHole, isHole); if (isHole) { AmiHoleDescrip *pHole = (AmiHoleDescrip*) pDescrip; AmiValue diameter, drillAngle; amiGetHoleData(pHole, diameter, drillAngle); acutPrintf(Hole diameter is %f\n, diameter.getValue()); } pDescrip->release();
In the example above, the function amiIsDescripKindOf is called to see if the descriptor returned from amiGetFeatDescrip refers to a hole feature (drilled, counter bore, or counter sink). If it does, the pointer is cast to the appropriate type and passed into the function amiGetHoleData. The values returned from that call are AmiValue objects. The AmiValue object is designed to be lean and constructable on the stack. The value object will contain a double or a AmiParamKey* depending on the value of fReturnParameters in the call to amiGetFeatDescrip. Once a value object is obtained, a numeric value can be obtained via the objects getValue method regardless of what is really inside. The two main AmiValue methods that are of interest are:
double getValue() const; AmiParamKey* getParam() const;
The getValue method is simple. Regardless of whether the value object contains a double or a parameter key, a call to getValue will return a valid numeric value. The getParam method is a little different though. If the value object contains a double, a call to getParam will return a NULL pointer. If, on the other hand, a value object contains a parameter key, a call to getParam will return a copy of the contained key. This is an important thing to remember. An AmiValue owns its data. In other words, an AmiValue object only exposes copies of what it contains. This means that if you query for a parameter key, you get a copy. Furthermore, if you make a copy of an AmiValue (which you can do) and that value contains a parameter key, the key is copied. Lastly, when a value object is destroyed, the key is destroyed with it.
05/12/2001 Page 53
Descriptor Creation
Looking first at an example:
AmiFeatKey *pKey; Assume this is a valid feature key obtained by the user. AmiFeatDescrip *pDescrip; AmiStatus stat; stat = amiGetFeatDescrip(pKey, pDescrip, Adesk::kTrue, Adesk::kFalse);
The function call above simply passes in a valid feature key and gets back a pointer to a new feature descriptor object. The second and third parameters are booleans which tell the API how lean you want your descriptor to be. The first boolean parameter fReturnInformers specifies whether or not informer information (location and termination info) should also be included with the descriptor. Although this information is obviously very useful, it can also be expensive so if its not needed, it is best left out. The second boolean parameter fReturnParams specifies whether value information should come back in the form of real numbers (double) or in the form of parameter keys (AmiParamKey*) again for optimization purposes.
Informers
Location and termination information is encapsulated into its own set of objects called informers. Once a pointer to a feature descriptor is obtained, the termination information can be obtained from the descriptor via a call to amiGetTerminator. Once a terminator is obtained, the terminator type can be queried and then the appropriate API function can be called to obtain the termination information.
AmiFeatDescrip *pDescrip; AmiTerminator *pTerm; A hole descriptor (for example).
amiGetTerminator(pDescrip, pTerm); AmiTerminatorType tType; amiGetTermType(pTerm, tType); if (tType == Ami::kBlindTerm) { AmiBlindTerm *pBlindTerm = (AmiBlindTerm*) pTerm; AmiValue depth; amiGetBlindTermData(pBlindTerm, depth); acutPrintf(Hole depth = %f\n, depth.getValue()); } pTerm->release();
Similarly, location information can be obtained from a feature descriptor. A feature descriptor pointer can be passed to the function amiGetLocator and a pointer to the descriptors locator object will be passed back. The difference here is that a locator by itself has no type. A locator is made up of subobjects called atomic locators. Once a pointer to a locator is obtained, it can be passed into the function amiGetAtomLocators which will return a list of the atomic locators that make up the location information for the original feature. As an example, suppose there is a hole descriptor that was located at a distance from two edges. The locator for the hole would be made up of two atomic locators of type AmiDistFromLoc. Each of these sub-objects will contain a geometry key to a line representing an edge and a corresponding distance value.
// have a feature descriptor pointer (AmiFeatDescrip *) called pDescrip... // AmiLocator *pLoc = NULL; amiGetLocator(pDescrip, pLoc); int nLocators; AmiAtomLocator **pLocators = NULL; if(amiGetAtomLocators(pLoc, nLocators, pLocators) != Ami::eOk) return;
05/12/2001 Page 54
for (int ii = 0; ii < nLocators; ii++) { AmiAtomLocatorType locType; if(amiGetAtomLocType(pLocators[ii], locType) == Ami::eOk) if(locType == Ami::kDistFromLoc) { AmiDistFromLoc *pDistLoc = (AmiDistFromLoc*) pLocators[ii]; AmiValue dist; if(amiGetDistFromLocData(pDistLoc, dist) == Ami::eOk) acutPrintf("Distance from edge = %f\n", dist.getValue()); } pLocators[ii]->release(); } delete[] pLocators; pLoc->release();
New data types and functions have been added for pattern creation and query of pattern data. These functions are documented in mifeat.h. In addition, locators may be used for patterns as follows. Rectangular patterns use an AmiAlignedLoc when the columns are aligned to an edge. This locator should contain a key to an edge or a work axis.Polar (and axial) patterns use locators to specify the rotation center. The following types of locators may be used: an AmiAlignedLoc (containing a key to a work axis), an AmiCoincidentLoc (containing a key to a work point), or an AmiConcentricLoc (containing either an AmiCurveKey to a cylindrical edge, or an AmiSurfKey to a cylindrical face).
AmiSelection
The class AmiSelection is found in the file miselect.h and is used for passing data to the sketch creation functions. When creating 2D sketches and 3D polyline paths, the geometry used to create the sketch can either be MDT geometry data (edges) or AutoCAD data. The AmiSelection class provides a single object to encapsulate a geometry selection. A selection object can be created using either a geometry key (AmiGeomKey*) or an object ID (AcDbObjectId). When a collection of selection objects is used to create a 2D path sketch, the path start point is specified by also specifying a pick point (AcGePoint3d) in addition to the geometry on the first selection. The AmiSelection class contains several methods for setting and getting the underlying geometry. Any method can be called to reset the geometry on a selection. When getting the geometry, however, the appropriate method must be called based on whether the selection is holding a geometry key or an object id. The type of the underlying geometry can be queried by calling the "getType" method. AmiSelection::Type getType() const; The return value will be on of the following three values. AmiSelection::Unset - No geometry has been set on this selection AmiSelection::GeomKey - Selection is a geometry key AmiSelection::DbId - Selection is an object id
05/12/2001 Page 55
Constraint Descriptors
AmiDescrip objects are used for access to properties of either sketch or assembly constraints. These descriptors describe the operands and the relationship between them. Any available display information is also provided. The current set of attribute keywords are defined in the AmiConstrAttribute enum.
File Descriptors
amiFileDescrip, in general, is used to encapsulate information about files used by Mechanical Desktop. It is used by the Table-Driven Versions functions to describe the versioning spreadsheet which defines either part variables and feature suppression or global design variables across versions. Future APIs will support registering an applications input or output files with the registered PDM using file descriptors. File descriptors use amiSetData / amiGetData to access data members. This mechanism is similar to that used in Drawing Manager View and Section Descriptors (See the Table-Driven Versions section of Chapter 3 for more information). File Descriptors have their own enumerator to define the available attributes (AmiFileAttribute) and support file specific data types. There are overloaded versions of the accessor functions for each data type required, such as int, char* and AmiSectionStructureSee the table in the description of amiSetData and amiGetData for information on the appropriate data types for the different attributes. This table will expand as additional attributes become available on file descriptors.
application provide the correct value to this attribute as required by the callback to avoid memory leaks or memory stomping. Once the descriptor is finalized, the function amiRegisterEventReaction takes the information and starts the notification process. From that point forward, the callback function is called each time the event occurs. This continues until either the session is ended or the callbacks are unregistered. The event reaction descriptor may be deleted after calling amiRegisterEventReaction. Each event imposes a specific callback function signature. Along with the description of amiRegisterEventReaction there is a table of currently supported function pointer types, the prototype they define and a brief description. New function types will be added to this table as needed.
05/12/2001 Page 57
Class Hierarchy
The class chart shows all of the feature descriptor and informer classes, their class hierarchy, and the information that can be obtained from each class.
AmiFeatDescrip ( pPartKey ) Go to chart three
AmiBaseDescrip ( pBrep )
AmiHoleDescrip ( diame ter, drillAngle, directionVec ) AmiThinExtrusionDescrip ( thickType, thickness1, thickness2, fExtend )
AmiDrilledHoleDescrip
AmiUniFilletDescrip ( radius )
AmiFixedFilletDescrip ( chordLength )
AmiParametricBoolDescrip ( pCompKey )
Go to chart two
05/12/2001 Page 58
AmiConstrGeomDescrip ( pGeomKey )
AmiWorkPointDescrip
AmiLoftDescrip ( loftType, fMinimizeTwist, rStartWeight, rEndWeight, fTangentToStart, rStartAngle, fTangentToEnd, rEndAngle, nXSection, pXSections )
AmiWorkAxisDescrip
AmiSplitDescrip
AmiSketchPlaneDescrip
AmiPartSplitDescrip ( fFlipNormal )
05/12/2001 Page 59
AmiLocator
AmiDistFromLoc
AmiAtomLocator
AmiAlignedLoc
AmiTerminator
AmiPerpendicLoc
AmiBlindTerm
AmiParallelLoc
AmiThroughTerm
AmiCollinearLoc
AmiToPlaneTerm
AmiTangentLoc
AmiToFaceTerm
AmiHorizontalLoc
AmiFromToTerm
AmiVerticalLoc
AmiMidPlaneTerm
AmiCoincidentLoc
AmiIns ideTerm
AmiOnPlaneLoc
AmiOutsideTerm
AmiAbsolute Loc
AmiAngledLoc
AmiOffsetLoc
05/12/2001 Page 60
Composite Features
As of MDT5, the MCADAPI allows third parties to create composite features. A composite feature is simply a feature made up of other features. Using these composites, a third party can create a custom feature made up of any number of standard MDT features and hide the MDT features within their own custom (composite) feature. The browser displays the resulting feature as one item and the features contained within the composite are highlighted and selectable as one item. A third party can even register a callback so that they can handle editing of the composite when it is selected for edit. Composite features are only available through the MCADAPI and, more specifically, are handled by the feature API. Many similarities exist between how these features are handled and how standard MDT features are handled but there are also many important differences. 1. Feature query is the same as with any feature. Given a feature key, the API can be used to obtain a descriptor to that feature where the individual elements that make up the composite can be queried. 2. Feature create is where the big difference comes in. A composite feature in not created but, instead, it is "started." When a composite feature is started, a transaction starts up internally and any features created from that point on are added to the composite until such time that the composite feature is "ended." Once the composite feature is ended, the internal transaction is closed and MDT reverts back to its regular state. Optionally, a composite feature can also be "aborted" which aborts the internal transaction erasing the composite and any features that were added to it. The fact that an internal transaction is started when a composite feature is started is very important to remember. If a third party starts their own transaction before starting the composite and then ends their transaction before the composite is ended, the composite's transaction will also be closed. This is very undesirable behavior. Therefore, it is recommended (and almost mandatory) that the composite feature be started, defined, and ended within a single area of code so that the result looks like a "sandwich" where the individual features are sandwiched between the start and end composite calls. 3. Only one composite feature can be in the process of creation within a single document at any given time. As described above, starting a composite puts the current into a "state" so, until the composite is ended, another cannot be started. Two of the composite feature descriptor items are mandatory in order to begin creation of a composite feature. Those items are the feature type string and the owner info string. 1. The feature type string is provided as a way for third parties to keep track of what this feature is in their application. If a third party application has several different types of features that are represented in MDT as composites, they may want to perform edit operations differently depending on the type. This string provides a key for that application to differentiate between their own types of features. 2. The owner info string servers several purposes. First, the string itself is a null terminated string made up of three tokens separated by semicolons. The first token should be the owner application's company name. The second token should be the name of the creating application. The third (optional) token should be a URL where a user can go to the third party for information or downloads. Mostly, the layout of this string is for future use. Today, however, we use the owner info string to register the edit callback function described below. When a composite feature is created, the creator has the option of specifying a list of driving parameters to the composite. These are pre-created parametersthat are used to control the appearance
05/12/2001 Page 61
of the feature. By default, if a composite feature is selected for edit, nothing happens. If these driving parameters are specified at create time, selecting the composite for edit will bring up the standard MDT part/global variables dialog which will contain the list of the specified driving parameters allowing the user to edit them. Another option for editing is for the third party to register a callback function to be called whenever the composite is selected for edit. The callback is registered using the composite's owner info string. This would mean that one edit callback is registered per application. When a composite feature with a matching owner info string is selected for edit, the registered function is called. It is then up to the application to determine the type of feature that was selected (using the feature type specified at create time) and act accordingly. Lastly, the introduction of composite features influences the behavior of some of the functions already in place that deal with feature keys. For example, functions such as amiSuppressFeat and amiEraseObject will act on the composite and all of the features contained within the composite. Functions returning features like amiGetPartFeats will return a single key to the composite excluding keys to the features contained within the composite. The functions amiGetFeatsFromSketch and amiGetFeatsFromGeom have been modified to take a boolean flag allowing the caller to specify whether to return the composite or the innermost contained feature when a found feature is contained within a composite.
AmiStatus Overview
All MCADAPI functions return an AmiStatus object on the stack. In the past AmiStatus has been an enum datatype -- it has been redefined to be a class in the Ami namespace (Ami::Status). We have multiple status values for success, as well as all the previously supported values for errors. There are four severity levels to MCADAPI status values. These are used to distinguish errors from warnings, as well as to provide two degrees of severity for errors. The meanings of these four severity levels are: kInfo normal outcome kWarning successful outcome, but unusual in some way (e.g. incomplete result) kError failure; all output arguments are undefined kSevere severe failure (e.g. file corruption or other chronic problem) When an MCADAPI function returns failure (kError or kSevere), any output parameters are left undefined. When an MCADAPI function returns success (kInfo or kWarning), the output parameters can be expected to contain valid data and the caller is responsible for proper clean-up (e.g. calling release() on keys and descriptors, freeing storage for traditional C strings, etc). Typically, a warning status is returned when the operation was at least partly successful and all of the output parameters hold valid data. Returning a warning instead of an error allows MCADAPI functions to produce meaningful results in the face of minor errors, rather than imposing an all-ornothing semantics. For example, an MCADAPI function that produces an object descriptor when given a key, might return a warning status if there is an error while populating one of the attributes in the descriptor. In this situation, it is preferable to produce the incomplete descriptor than to return failure, which would imply that the output parameter is unset and no descriptor is produced. The incomplete descriptor can't be used as-is to create a new object in MDT, but the non-offending attributes can be queried, and the offending attribute can be set by the external application. Until it is set by the application, that attribute will be "Not A Value" (NAV; see the discussion of AmiDescrip.)
05/12/2001 Page 62
AmiStatus objects hold additional information to better pinpoint the nature of an error or warning. When the problem can be attributed to a particular input parameter to the MCADAPI function, the argIndex() method will return the parameter index for the offending argument (numbering begins at 0). When the problem can be attributed to a particular attribute in a descriptor, the attrKeyword() method returns the keyword for that attribute. These methods return integers, with negative values used to indicate that the data is not available. It should be emphasized that the new implementation of AmiStatus is fully compile-time compatible with the old implementation. There is no need to re-code applications. The old enum symbols will continue to be supported in future releases. They serve as a convenient short-hand for specific AmiStatus values by coupling an Ami::StatusCode with an Ami::Severity.
CLASS AmiStatus
All MCADAPI functions return AmiStatus objects. The AmiStatus holds a simple status to convey the outcome of the function. This includes error codes, warning codes, and success codes. Query access: success() Return true if this is not an error status. failure() Returns true if this is an error status. severity() Returns the severity of the status. symbol() Returns an enum value which represents the basic type of status. argIndex() Returns the position of the function argument that gave rise to the status. Numbering begins with 0, and a negative number is returned if no argument has been singled-out as the cause. arrayIndex() When argIndex() indicates that an array input argument is the cause of the status, and the problem can be further pinpointed to a particular element, then this function returns the index of that element. Numbering begins at 0, and a negative number is returned if no element is singled out. attrKeyword() When argIndex() indicates that a descriptor input argument is the cause of the status, and the problem can be further isolated to a single attribute, then this function returns the keyword for that attribute. Note: the keyword is passed back as an 'int' and not as an enum. This is because there is no single enum datatype for attributes of all descriptor types (the enum values are distinct, however, so there is no loss of information in using an 'int' here). text() Returns a string holding a short text description of the status. operator == operator != Comparisons are possible between two AmiStatus objects, between an AmiStatus and an enum symbol, etc. operator < This comparison returns true if the LHS is less severe than the RHS. If both operands have severity kInfo, then this comparison will still return true if the RHS has a non-kOk symbol while the LHS is kOk. Edit access: setSeverity()
05/12/2001 Page 63
Sets the severity to the given level. setSymbol() Sets the symbol to the given StatusCode value. setArgIndex() Sets the arg-index to the given value. setArrayIndex() Sets the array-index to the given value. This will overwrite the attribute-keyword if it is set. The attribute-keyword and array-index cannot be used together in the same AmiStatus instance. setAttrKeyword() Sets the attribute-keyword to the given value. This will overwrite the array-index if it is set. The attribute-keyword and array-index cannot be used together in the same AmiStatus instance. operator = The assignment operator. operator += This operator performs an assignment if and only if LHS<RHS holds. It can be used to "accumulate" status values. Notes: AmiStatus objects can be compared directly to Ami::FlatStatus enum values. The Ami::FlatStatus value will be promoted to an AmiStatus before the comparison takes place, with the severity of the promoted object set to kError. There is ONE exception: Ami::eOk is promoted to AmiStatus(kOk, kInfo). The same promotion rule is used when an AmiStatus variable is assigned an Ami::FlatStatus value. For example, the following equalities hold: AmiStatus(Ami::kInvalidArg, Ami::kError) == Ami::eInvalidArg AmiStatus(Ami::kOk, Ami::kInfo) == Ami::eOk AmiStatus status; (status = Ami::eInvalidArg)== Ami::eInvalidArg When an AmiStatus object is constructed or assigned a value using an Ami::StatusCode, the same promotion rules apply -- the severity is assumed to be kError except for kOk which has severity kInfo. So, for example, AmiStatus(Ami::kInvalidArg, Ami::kError) == Ami::kInvalidArg AmiStatus(Ami::kOk, Ami::kInfo) == Ami::kOk While Ami::StatusCode values often correspond to Ami::FlatStatus values, there is no guarantee. For example, the following equality is not guaranteed to hold in future releases: Ami::eInvalidArg == Ami::kInvalidArg
File Structures
MDT supports two basic file structures: Assembly files and Part files. Part files are useful for situations in which the full DWG structure, full UI, and full API are not needed because the user is only interested in modeling a single part.
05/12/2001 Page 64
Thus, a Part Only File is structured much like a "flat assembly," where the part itself, along with any unconsumed toolbodies, can be referenced as a component inserted into the master assembly. This can lead to confusion because conceptually there is only one part in a Part Only File and therefore it is easy to overlook the insert of that part-definition into the master component definition of the Part Only File. It is easy to confuse an AmiCompKey that references the entire Part Only File with an AmiCompKey that references the leaf-node component for the base part in that file. This distinction is especially easy to overlook in the case where the Part Only File has no toolbodies (yet). The flat assembly hierarchy is enforced -- it is not possible to create a subassembly in a Part Only File. All component definitions other than the master component definition will be a definition for a single solid (e.g. the part, the toolbodies). Unlike a normal assembly DWG, unconsumed toolbodies in a Part Only File are tagged as toolbodies from the moment they are created. In an assembly file, an unconsumed toolbody is no different than any other component -- it does not take on the role of toolbody until it is used in a parametric-boolean feature. For Part Only Files, where there can be only one part, there is no ambiguity in the role of subsequent solids: they are toolbodies. This makes is easy to distinguish the grounded base part from all other AmiPartKey objects and AmiCompKey objects for the Part Only File. In the case of an XRef'd Part Only File, the Browser presents users with a single part (hiding any unconsumed toolbodies). The MCADAPI, however, allows the Xref'd Part Only File to be used as a flat assembly. Thus, if you obtain an AmiCompKey from a pick on an Xref'd Part Only File then you can use amiGetCompChildren() to obtain keys for any unconsumed toolbodies in that Part Only File (in addition to a key for the grounded base part). It is important to realize that the AmiCompKey obtained from a pick on an Xref'd Part Only File is an AmiCompKey that refers to the entire Part Only File and not just to the leaf-node component that is the grounded base part. When you use amiPick() with Xref'd Part Only Files, the AcDbFullSubentPath encapsulated in the AmiPick object has the following characteristics:
If the Part Only File is not open for Xref Edit, and the user clicks on graphics on the grounded base part, then the AmiPick object will reference the entire Part Only File. If this AmiPick object is used to create an AmiCompKey then the comp will be for the entire (albeit flat) assembly in the Part Only File.
If the Part Only File is not open for Xref Edit, and the user clicks on graphics on an unconsumed toolbody, then the amiPick() function will cycle between two choices: one choice yields an AmiPick object that references the entire Part Only File (as with picks on the grounded base part); and the other choice yields an AmiPick object that references the specific toolbody instance picked. If the user chooses the second of these options, and if this AmiPick object is used to create an AmiCompKey, then the component will be for that leaf-node toolbody instance, in the scope of the active component definition in the host database. If the Part Only File is open for Xref Edit, then the amiPick() function will behave as it does when the Part Only File is loaded directly. The AmiPick object will reference the leaf-node that was picked, in the context of the master definition in the Part Only File. Thus, to obtain an AmiCompKey object that references an Xref'd grounded base part in the context of the master assembly using amiPick(), you must use amiGetCompChildren() with the (assembly) component key obtained from the pick object. If the user clicks on an unconsumed toolbody instead of
05/12/2001 Page 65
on the grounded base part, then you must use amiGetContainingComp() first and then amiGetCompChildren() to get the corresponding grounded base part leaf-node comp key. When using amiGetActiveLeafNode(), the AmiCompKey returned is always a leaf-node component. Thus, when an Xref'd Part Only File is open for Xref Edit, the output of amiGetActiveLeafNode() refers to the grounded base part in the Xref'd file, in the context of the active component definition (in the host database).
Coding Practices
The MCAD API observes the following conventions:
Return Values
All functions return a status that the program must check to verify that the function executed successfully.
undo filer; the transient count is unaffected by undo filing (i.e. it is not restored when reading from the undo filer). The following rules describe MCADAPI behaviour with respect to reference counts: All MCADAPI functions except amiReadKey() call addRef() on any output arguments that are pointers to MCADAPI objects. = The erase() method on AmiObjectKey increments/decrements the persistent reference count in accordance with the bool argument. The persistent count is decremented for erase(true) and incremented for erase(false). We recommend the following practices: = Calls to addRef() should be paired with calls to release(). = Calls to MCADPI functions that pass back pointers to keys should be paired with calls to release(). = Except for amiReadKey(), which is the only MCADAPI function which should be paired with calls to erase() instead of release(). = Calls to addPersistentRef () should be paired with calls to erase(). = In the subErase() method for any custom objects that hold pointers to MCADAPI keys, call erase() on those keys. = Use addRef() and release() accordingly when using variable aliasing (data sharing). = Call the release() method before allowing a pointer to an MCADAPI object to go out of scope. = When assigning the value of a local variable that points to an AmiObjectKey to a nonstatic data member of a custom database object, call addPersistentRef() followed by release(). =
Coding Examples
For examples of how to make calls to the MCAD API, see the sample applications in Appendix A.
05/12/2001 Page 67
Common
The following functions are useful for AutoCAD or Mechanical Desktop models.
Fills data fields of pickObj given a result buffer in the format returned by acedSSNameX() and the type of key to be created using pickObj. Note that, when set to Adesk::kTrue, the allowGhost flag is effective only for Mechanical Desktop part edges or vertices.
Input
pickResBuf type
allowGhost
Output
A resbuf that contains pick information as formatted and returned by acedSSNameX(). The type of the key that the caller creates. An abstract type can be used. Not all concrete types are supported (e.g. compKey, dwvwKey, dwLayoutKey, and sceneKey are not supported. A value of true when the caller wants resolution even if the entity has disappeared, for example, resolution to an edge that has been chamfered. An object with all of its data fields filled that represents the object picked by the user. This construct can then be used to create a key to the object selected by the user.
pickObj
AmiStatus amiGetPickInfo ( AmiPickObj* pPickObj, AcDbFullSubentPath& subentPath, AcGePoint3d& pickPoint, AcGeVector3d& pickVector, AcGeMatrix3d& viewTrans, Adesk::Boolean& isGhost)
pPickObj
Output
Pick point. Pick vector. View transformation matrix. True if geometric resolution is possible even after the entity has disappeared.
AmiStatus amiPick
(const char* prompt, AmiKeyType type, struct resbuf* entmask, AmiPickObj& pickObj, Adesk::Boolean allowGhost, Adesk::Boolean activeInstance, const char* keyWords, const char defaultKeyWord, Adesk::Boolean includeInList, char** keyWordUsed )
Prompts the user to pick a single object and fills the pick object data fields. The pick object (pickObj) can be used in creating a key to the object picked by the user. Note that, when set to Adesk::kTrue, the allowGhost flag is effective only for Mechanical Desktop part edges or vertices.
Input
The prompt displayed to the user. The type of key that the caller intends to create. An abstract type can be used. The kind of result-buffer list that acedSSGet() uses to filter a drawing to select particular entities. A value of true when the caller wants resolution even if the entity has disappeared, for example, resolution to an edge that has been chamfered. A value of true restricts the picking to the currently active part instance (if valid for the specified key type).
defaultKeyWord
Output
A list of keywords separated by spaces. For localization support, use the AutoCAD standard format to represent the keywords. For example: localAaa localBbb localCcc_Aaa Bbb Ccc. Specifies a keyword. Use NULL for no default keyword. The localization format can ge used if necessary. For example: localDefault_Default.
An object with all of its data fields filled that represents the object picked by the user. This construct can then be used to create a key to the object picked by the user.
pickObj
keyWordUsed
includeInList
The keyword that the user accepted. If localization is used, the user-accepted keyword will be the English keyword. This argument is only filled when the return status is kKeyWord. The user is responsible for releasing the memory used by keyWordUsed. TRUE indicates that the default keyword is added to the main list, e.g. [Aaa/Bbb/Ccc/Ddd]<Ddd>. FALSE indicates that the default keyword is not added to the list, e.g. [Aaa/Bbb/Ccc]<Ddd>.
Creating Keys
Keys are created based on data encapsulated in the pick object. Keys provide MCAD API users with a uniform, persistent mechanism to refer to objects in application models. Keys are used as arguments in most MCAD API functions. The following functions provide different ways to construct keys.
AmiStatus amiGetInferGeom ( AmiGeomKey* pInferredGeomKey, int& numGeomKeys, AmiGeomKey**& pGeomKeys )
05/12/2001 Page 69
For geometry which is inferred from other geometry, for instance a (mid)point from a line, this function eturns keys to the geometry used to make that inference. In the example above, a line key to the referenced line would be returned. If the geometry is not inferred Ami::eNotApplicable is returned.
Input
pInferredGeomKey
Output
numGeomKeys pGeomKeys
Number of keys in the above array. Array of geometry keys used to infer the geometry referenced in pInferredGeomKey.
AmiStatus amiGetKeyFromId ( AcDbObjectId id, AmiKeyType type, AmiObjectKey*& pObjectKey, Adesk::Boolean inferFlag = Adesk::kTrue, AcDbSubentId* pSubId = NULL, AcGePoint3d* pPoint = NULL )
Creates a geometric key from the given object id. If an error occurs a bad status is returned and pObjectKey is set to NULL. NOTE: If a point key is requested and a sub id is passed in, the given sub id should represent an edge that contains the appropriate vertex subentity. It should not represent the vertex subentity. Use the point parameter to indicate which vertex in the edge to use. Also, this function should not be used when the entity is blocked. An object key will be returned, but data retrieved from the object key will not be adjusted with respect to the entitys inserted position. Instead, use amiGetKeyFromPath and send in an AcDbFullSubentPath that lists the containing inserts. It is the callers responsibility to release the key.
Input
The object id from which the geom key is created. Indicates what kind of key to create. Indicates whether or not to infer a key. An optional subentity from which to create the key. An optional point to clarify how the key should be created.
Creates an object key from the given subentity path. The key will refer to the subentity identified by the subentPath, if any. If no subentity is identified, the key will refer to the entity itself. If the entitys id is not contained in the AcDbFullSubentPath, an error is returned. If an error occurs, a bad status is returned and pGeomKey is set to NULL. NOTE: If a point key is requested and a sub id is passed in, the sub id in the given subentity path should represent an edge that contains the appropriate vertex subentity. It should not represent the vertex subentity. Use the point parameter to indicate which vertex in the edge to use. It is the callers responsibility to release the key.
Input
subentPath
05/12/2001 Page 70
Indicates what kind of key to create. Indicates whether or not to infer a key. An optional point to clarify how the key should be created.
Creates an object key from a pick object and returns the type of key created. If an error occurs, a bad status is returned and pObjKey is set to NULL. It is the callers responsibility to release the key.
Input
pPickObj
Output
The pointer to the pick object. The type of the key that was created. The pointer to the key.
type pObjKey
pPickObj1, AmiPickObj* pPickObj2 = NULL ) Creates a geometric key of a specified type using information passed in by pick objects. The function can infer geometry from other geometry. A point can be inferred as the endpoint of an open curve, the midpoint of a picked line, the center point of an arc or ellipse, or as the midpoint of a circular arc. A line can be inferred as the axis through the center of a picked arc perpendicular to the plane of the arc. A line can also be inferred from the endpoints of a spline. A plane can be inferred as the plane of a picked arc or by two coplanar lines that were picked. If the operation cannot be completed a bad status is returned and pGeomKey is set to NULL. It is the callers responsibility to release the key.
Input
type inferFlag
The type of the geometry to be created. A flag set to true or false to allow or disallow geometry to be inferred from other picked geometry. pPickObj1 Pick information. pPickObj2 Additional pick information required to infer the final key when two picked entities are involved as in inferring a plane from two coplanar lines.
Output
Attempts to create an inferred geom key of the given type using all the geometry keys given in pGeomKeys. The proximity point is used to disambiguate among choices, and the choice closest to the proximity point is returned. The same inferences made in amiGetGeomKey will be made in creating the key. For instance, a point key can be inferred from a line key. The appropriate end of the line is determined by which is closer to the proximity point.
Input
pGeomKeys
numGeomKeys Number of keys in the above array type Type of geometry key to be created. proximityPoint A point used to disambiguate among alternative keys which could be inferred.
Output
pInferredKey
Handling Keys
The following functions provide general functionality to handle any key. These functions allow keys to be checked for equivalence, to be copied, to be erased, and to be written/read to/from a filer.
AmiStatus amiAreKeysEquivalent ( AmiObjectKey* pKey1, AmiObjectKey* pKey2, Adesk::Boolean& areEquivalent, Adesk::Boolean considerComp = Adesk::kTrue, Adesk::Boolean* differsInCompOnly = NULL )
Compares two keys to determine if they refer to the same entity. The pKey1 parameter points to the first object key. The pKey2 parameter points to second object key. When the function returns, the areEquivalent parameter is true if the keys resolve to the same entity; otherwise, it is false. The considerComp parameter allows you to determine not only whether the geometry or features of two keys are equivalent, but also whether they are located on the same component. The two keys must resolve to the same lowest-level component to be equal. The differsInCompOnly parameter allows you to determine whether the difference between keys is caused solely by location on different components. Note also that considerComp is applicable only to component keys, geometry keys and feature keys. It is ignored (differsInCompOnly returns false) for part, constraint, parameter, sketch, solid and component definition keys.
Input
The pointer to the first object key. The pointer to the second object key. If true, the equivalence test considers the component as a criterion for determining if the keys are equivalent. If false, the component is not considered. In other words, if true, the two keys must not only refer to the same geometry or feature to be equivalent, but they must also be on the same component. If false, two keys that refer to the same geometry or feature will return a value of true regardless of component. A value of true if the keys resolve to the same entity; otherwise, it is false. If a pointer to a Boolean is specified here, the result will show whether the keys are not equivalent only because they are located on different components. This is independent of the considerComp argument and is ignored if a NULL pointer is specified.
Output
areEquivalent differsInCompOnly
Copies the given key and returns another key that resolves to the same application object as the original key. AmiCopyKey should be used: before enabling active notification
05/12/2001 Page 72
to put the key in a different database before using AddPersistentRef. The new key created by this function will not be persistent, regardless of whether the original key was persistent. If the new key should be persistent, then you must call addPersistentRef. pTargetDatabase defaults to the Desktops current database (returned from amiGetCurrentDatabase). The database does not need to contain the nested entity, but the nested entity must be accessible from the destination database. If it isnt, the key will be invalid if the destination database is opened from a different document. The destination database must be the same as the database returned by amiGetAssociatedDBs, if one is returned. If no database is returned, then the key can be copied to any database desired. It is the callers responsibility to release the key.
Input
A pointer to the original key. pTargetDatabase The database into which the key is copied. Defaults to the Desktops current database (returned from amiGetCurrentDatabase).
pObjKey
Output
pCopy
pObjKey
Output
type
This function gets the databases used to build the key. A key may be associated with zero or more databases. If there are no database objects used in the key, pDbs is set to NULL and numDbs = 0, but the returned status is not an error status.
Input
pObjKey
Output
Pointer to a key. Number of databases used to build the key. Pointer to an array of AcDbDatabases.
numDbs pDbs
Checks if the type of the key is derived from or the same as type.
Input
pObjKey type
Output
05/12/2001 Page 73
isType
A value of true if the key is of the same type as type or if the key type is derived from type; otherwise, isType is false.
pObjKey
Output
A pointer to an object key. A value of true if the key is null; otherwise, it is false.
nullKey
Reads a key from a given filer. This function is usually called from the dwgin method of the application object that owns the key. It is the callers responsibility to release the key.
Input
filer pFilingObj
Output
pObjKey
AmiStatus amiRefocusKey
( AmiObjectKey* pObjKey, AmiObjectKey* pRefKey, AmiObjectKey*& pNewObjKey = AMI_NULLOBJKEYREF )
Creates a new key from pObjKey which refers to the equivalent object to that referred to by pObjKey at the scope implied by pRefKey. Five basic types of refocusing operations are supported by this function. The first type of refocusing operation takes place between a part and an instance of that part. For example, if one has a line key to the boundary of a part, it is possible, using this function, to obtain a key to the same line in the scope of an instance of that part in an assembly and vice-versa. The second type allows the caller that has a key to an entity on a given instance of a part to obtain a key to the equivalent entity on another instance of the same part. For example, if one has a feature key to a hole on the front left wheel of a vehicle, one could obtain the key to the same hole on the rear right wheel of the vehicle. The third type allows the caller to map from a geometry key to AutoCAD wire-frame geometry to equivalent sketch geometry if the geometry was consumed by a sketch (the reverse operation, that is, going from the sketch geometry to the AutoCAD geometry is not supported). For example if one has a line key to an AutoCAD line that was used in a sketch, this function can return the equivalent sketch line key (which would be needed, say, to create a sketch constraint involving that line). If there is no equivalent sketch geometry in the scope of pRefKey, then an error is returned with symbol kUnmatchedLeafObject. The fourth type allows the caller to extend or reduce the scope of a key. For example, if one has a key to the edge of a wheel in the scope of the wheel assembly, one could extend the scope of that key to refer to the same edge in the context of the overall vehicle assembly, if one passes in a key that refers to a specific instance of the wheel in the vehicle assembly.
05/12/2001 Page 74
The fifth type allows the caller to map an entity that is in the scope of some component to the scope of a given component definition for one of its parent components. For example if one has a key to the to the edge of a wheel in the scope of the vehicle, one could obtain the key to the same edge in the context of the front axle assembly by passing the component definition of the axle assembly. If the pRefKey is incompatible with pObjKey, and therefore the key cannot be refocused, then an error is returned with status kFocusMismatch.
Input
pObjKey PRefKey
Output
Pointer to key to original entity. Only geom, feature, component and sketch keys are supported. Pointer to key to object that specifies desired focus (currently only component, part, component definition, geometry, sketch and feature keys supported).
Key created which references the equivalent object as pObjKey in the scope of pRefKey. To refocus a key in place, without creating a new key, you can allow the return key to default to AMI_NULLOBJKEYREF, which is a null reference. eUnmatchedLeafObject Returned if there is no equivalent sketch entity in the scope of pRefKey. kFocusMismatch Returned with severity kError if the reference key is incompatible with the object key (e.g. neither is in the scope of the other).
pNewObjKey
AmiStatus amiWriteKey ( AcDbDwgFiler* filer, AcDbObject* pFilingObj, AmiObjectKey* pObjKey )
Writes the key to the given filer. This function is usually called from the dwgout method of the application object that owns the key.
Input
Entity Highlighting
The following function provides convenient highlighting of an entity referred to by a key.
AmiStatus amiHighlight ( AmiObjectKey* pObjKey, Adesk::Boolean highlight, double scaleFactor = 1.0 )
Pointer to a key A value of true to highlight the entity referred to by pObjKey or false to turn off highlighting for the entity. A value applied to the default size of graphics used in highlighting unbounded or inferred entities.
05/12/2001 Page 75
Handling Geometry
The following functions allow the geometry referred to by a key to be retrieved or set. NOTE: Only geometry that is directly editable can be set.
AmiStatus amiGetGeomData ( AmiGeomKey* pGeomKey, AcGeEntity3d*& pGeEntity )
Returns an AcGe entity copy of the geometric object referred to by the specified key. The GeLib object that is returned is a snapshot of the geometric object referred to by the key at the time of the query. After its construction, the GeLib object is not kept up-to-date by the MCAD API. After being used, the GeLib object should be deleted.
Input
pGeomKey
Output
Pointer to geometry key that refers to the object for which an AcGe entity copy is needed. A pointer to the new GeEntity. NOTE: Free the memory allocated for GeEntity when it is no longer needed.
pGeEntity
AmiStatus amiGetSketchedSplineSegments ( AmiSplineCrvKey* pSplineKey, int& totalNumSegs, int startIndexNum, int endIndexNum, int* numSegsReturned, AmiLineKey*** pSegmentKeys )
Returns geometry keys to the spline segments of the given spline. The start and end indices can be specified, -1 in either position implies the first/last index respectively. The return keys are optional, so if pSegmentKeys or numSegsReturned is null, they are not created. A subset of the segments can be specified by specifying a start and/or end index. The defaults for these arguments specify the beginning and end of the list, respectively. If the end index is beyond the physical number of segments, the end of the list is assumed. These indices are 0 based (range from 0 to the numSegsReturned-1). When a sketch contains a spline, constraints are applied to the straight line segments between the control points. There is one segment that extends past each end point of the spline, representing the tangent lines. AmiGetSketchedSplineSegments returns geometry keys to these line segments to be used when constraining the sketch through amiCreateConstraint.
Input
Pointer to a spline key. When only a subset of the segments is to be returned, this is the first index to return. When only a subset of the segments is to be returned, this is the last index to return.
totalNumSegs
The total number of segments in the spline, regardless of start/end index arguments. numSegsReturned Number of segments specified by the start and end index. When pSegmentKeys is not null it contains this number of keys. (Optional) pSegmentKeys An optional list of pointers to geometry keys to the spline segments.
pLineKey
Output
Line key
Sets the data in the geometric object referred to by the specified key to the data in the Ge entity passed in. This call will be successful only if the geometry is directly editable as defined by the result of a call to amiIsDirectlyEditable.
Input
pGeomKey pGeEntity
Pointer to geometry key to entity to be set. Pointer to Ge entity to be used in setting the geometric object.
Disables active notification through the specified geometry key. NOTE: This operation is not undoable.
Input
pGeomKey
Enables active notification through the specified geometry key. Once enabled, active notification through a key is good for as long as the DWG file containing the key is loaded. The next time that the file is loaded, another call to amiEnableActiveNotification must be made to reinstate active notification through the key.
Input
A pointer to the geometry key to application geometry. A pointer to the function to be called when geometry changes. A pointer to the function to be called when geometry is erased.
AmiStatus amiEnableActiveNotification2 ( AmiGeomKey* pGeomKey, AmiNotifFcnPtr2 pChangeFcn, AmiNotifFcnPtr2 pEraseFcn, AcDbObjectId id)
Enables active notification through the specified geometry key. A pointer to the key passed in will be returned when notifying.
05/12/2001 Page 77
This function differs from amiEnableActiveNotification in that this function takes a database object id from the user. This id is returned during the notification process. For example, the id might be the database id of the object that owns the key and that will have to react to the change experienced by the geometry.
Input
A pointer to the geometry key to application geometry. A pointer to the function to be called when geometry changes. A pointer to the function to be called when geometry is erased. AcDbObjectId to be returned during notification.
Checks if the geometric object referenced by pGeomKey has changed since last checked. By default, notification is reset after the call, meaning that if a change is indicated in a call, a second call indicates change only if another change happened since the previous call. This resetting can be avoided by passing the value of resetNotification as Adesk::kFalse.
Input
pGeomKey resetNotification
Output
A pointer to the geometry key to application geometry. If true, passive notification will be reset; if false, passive notification will not be reset. A value of true if the application object changed; otherwise, it is false.
changed
pObjKey
Output
A pointer to the object key. A value of true if the application object was erased; otherwise, it is false.
erased
Creates a B-rep entity from the given object key. If an error occurs, a bad status is returned and pBrepEntity is set to NULL. The B-rep entity can be used to create a B-rep traverser. For this call to succeed, the key being passed in must refer to an entity that is part of a B-rep. Acceptable types are geometry keys and component keys to leaf node components. It is the callers responsibility to delete the B-rep entity returned.
Input
pObjKey
Output
05/12/2001 Page 78
pBrepEntity
Creates a geometric key from the given B-rep entity. If an error occurs, a bad status is returned and pGeomKey is set to NULL. It is the callers responsibility to release the geometry key returned.
Input
pBrepEntity The B-rep entity from which the geom key is created.
Output
pGeomKey
Handling Attributes
The following functions handle attribute attachment, removal and query through keys. For more information on attribute creation, see the section in chapter 4, Attribute Creation in the MCAD API.
AmiStatus amiAddAttribute ( AmiObjKey* pObjKey, AmiAttribute* pAttribute, Ami::AttrAssocType attrAssoc = Ami::kShareAlways )
Adds an attribute to the object referred to by the specified key. Currently only AmiGeomKey, AmiSolidKey, AmiPartKey, AmiFeatKey, AmiCompDefKey and AmiCompKey are supported. At the time the attribute is added, it is possible to specify what should be the behavior if the object is copied (attribute could be ignored, shared with the copied object, or a copy of the attribute could be attached to the copy of the object).
Input
A pointer to the object key. A pointer to an attribute object. The attribute object must already have been added to the database. Association type for this attribute when attached to pObjKey. Indicates whether the attribute should be copied, shared or ignored when the object is copied within a database or across databases.
AmiStatus amiGetAllAttributes (int& numAttributes, AmiAttribute**& pAttribsArray, AmiAttrMatchType type = Ami::kInstantiable, const char* className = NULL, AmiObjectKey* pObjKey = NULL )
Gets all attributes (owned by the MCAD API) attached in the current database. The type argument indicates what types of attributes to return, either derived, instantiable or both. The className can filter the attributes returned to only those that are instances of a specified attribute class. ClassName is compared with the name returned from AmiAttribute::getName, which is the public class name for the attribute.. pObjKey provides a scope from which attributes are retrieved. E.G. passing a part key returns all attributes attached anywhere on that part (through geom or part feature keys). A key can be used to filter the list returned to only those attached somewhere in that scope. For instance, if a part key is passed in, only attributes attached to geometry or features of that part are returned. It is the caller's responsibility to free the array (not the attributes) when it is no longer needed.
Input
The type of attributes to return. For instantiable attributes, class name to find. Scoping key.
05/12/2001 Page 79
Output
numAttributes pAttributesArray
The number of attributes found. An array of pointers to all attached attributes matching the query requirements.
Gets all the keys that have the specified attribute. It is the callers responsibility to release all the keys returned and delete the array.. Array of keys is not set if no objects are associated with the specified attribute, or if any error occurs.
Input
pAttribute
Output
Pointer to the specified attribute. Total number of keys found. Array of keys to all objects that have the attribute attached. To be freed by the user when finished using it.
numKeys pKeysArray
AmiStatus amiGetAttributes ( AmiObjKey* pObjKey, int& numAttributes, AmiAttribute**& pAttribsArray, Adesk::Boolean exactMatch = Adesk::kFalse)
Gets all the attributes that have been attached to the object referred to by the specified key. Currently only AmiGeomKey, AmiSolidKey, AmiPartKey, AmiFeatKey, AmiCompDefKey and AmiCompKey are supported. For geometry, component and component feature keys, attributes on the equivalent entity anywhere in the subassembly chain will be gathered and returned, if exactMatch = FALSE. It is the callers responsibility to free the array (not the attributes) when it is no longer needed. The array of attributes is not set if no attributes are associated with the entity, or if any error occurs. This function is overloaded (see below) to allow attribute query for B-reps without having to create a key.
Input
pObjKey exactMatch
Output
A pointer to the object key. A flag indicating whether to return attributes only when the holder is an exact match of pObjKey (TRUE).
The number of attributes found. An array of pointers to all attached attributes referred to by the specified key. To be freed by the user when finished using it.
numAttributes pAttributesArray
This overload of amiGetAttributes allows attribute query without creating a key by using an equivalent B-rep representation.
Input
pBrepEntity exactMatch
Output
A pointer to a brep entity. It is the callers responsibility to delete this brep entity. A flag indicating whether to return attributes only when the holder is an exact match of pObjKey (TRUE).
The number of attributes found.
numAttributes
05/12/2001 Page 80
pAttributesArray
An array of pointers to all attached attributes referred to by the specified key. To be freed by the user when finished using it.
AmiStatus amiRemoveAttribute ( AmiObjKey* pObjKey, AmiAttribute* pAttribute ) Removes an attribute from the object referred to by the specified key. Currently only AmiGeomKey, AmiSolidKey, AmiPartKey, AmiFeatKey, AmiCompDefKey and AmiCompKey are supported. This function is overloaded (see below) to remove a specific attribute without having to create a key to the holding object. Input
pObjKey pAttribute
( AcBrEntity* pBrepEntity, AmiAttribute* pAttribute ) This overload of amiRemoveAttribute removes a specific attribute without having to create a key to the holding object. The attribute is removed from the object referenced in the B-rep. Input
pBrepEntity pAttribute
A pointer to the brep entity. It is the callers responsibility to delete this pointer. A pointer to an attribute object.
Instantiable Attributes
AmiStatus amiDefineAttClass
( const char* className, int nFields, const AmiAttFieldDesc* pFields ) Defines a new instantiable attribute class.
Input
className Instantiable attribute class name. nFields Number of fields in the attribute. pFields Array of nFields field description structures.
AmiStatus amiGetAttClasses
( int& nClasses, const char**& classNames ) Gets the class names for all of the currently defined instantiable attribute classes. It is the caller's responsibility to delete the array of class names when finished.
Output
nClasses classNames
Number of defined attribute classes. Array of character buffers containing attribute class names.
Gets the field descriptions from and instantiable attribute class. It is the caller's responsibility to delete the array of field descriptions when finished.
Input
className
Output
05/12/2001 Page 81
nFields pFields
AmiStatus amiGetAttClassName ( AmiInstAtt* pAtt, const char*& className ) Gets the class name of the instantiable attribute. Input
pAtt
Output
Gets the value of an instantiable attribute field by name. This function is overloaded for all output types needed to support the current set of attribute field types. These types are: short& long& double& char& int& size, const short*& pArray int& size, const long*& pArray int& size, const double*& pArray int& size, const char* pArray
Input
Pointer to an instantiable attribute object. Name of field to get. The value for the field name.
Gets the value of an instantiable attribute field by index. This function is overloaded for all output types needed to support the current set of attribute field types. These types are: short& long& double& char& int& size, const short*& pArray int& size, const long*& pArray int& size, const double*& pArray int& size, const char*& pArray
Input
pAtt
index value
pAtt
Reads an ASCII file containing instantiable attribute class definitions. If a fully qualified path name is specified, the file at that location is opened for reading. Otherwise, the current attach point is scanned for the file.
Input
fileName
AmiStatus amiSetAttField ( AmiInstAtt* pAtt, const char* fieldName, <input type> value )
Sets the value of an instantiable attribute field by name. This function is overloaded for all input types needed to support the current set of attribute field types. These types are: short long double char int size, const short* pArray int size, const long* pArray int size, const double* pArray int size, const char* pArray
Input
Pointer to an instantiable attribute object. Name of field to set. The value for the field name.
Sets the value of an instantiable attribute field by index. This function is overloaded for all input types needed to support the current set of attribute field types. These types are: short long double
05/12/2001 Page 83
char int size, const short* pArray int size, const long* pArray int size, const double* pArray int size, const char* pArray
Input
Pointer to an instantiable attribute object. Index of field to set. The value for the field name.
Undefines a defined attribute class. If an attribute object has been instantiated in the current database from the named class, the class cannot be undefined.
Input
Writes the instantiable attribute class identified by the specified class name to an ASCII file located in the specified file. If a fully qualified path name is specified, the file is written to that location. Otherwise, the file is created at the current attach point.
Input
className Name of the class to be written. fileName Name of file to write to. fAppend Specify whether the file is appended or overwritten.
AmiStatus amiWriteAttClassesToFile ( const char* fileName, Adesk::Boolean fAppend )
Writes all of the currently defined instantiable attribute class descriptions to an ASCII file located in the specified file. If a fully qualified path name is specified, the file is written to that location. Otherwise, the file is created at the current attach point.
Input
fileName fAppend
Name of file to write to. Specify whether the file is appended or overwritten.
Miscellaneous
AmiStatus amiApplyColorOverride ( AmiObjectKey* pObjKey, Adesk::UInt16 color )
Applies a color override to the object specified by the object key. NOTE: Currently this function only works for construction features.
Input
05/12/2001 Page 84
pObjKey color
Creates an MDT system attribute. These attributes contain a single data field that can be of type Ami::kString, Ami::kLong, or Ami::kDouble.
Input
pName dataType
Output
The name to assign to the new system attribute. The field data type for the new attribute. Pointer to the newly created attribute.
pAttrib
Ends any XRef edit that is in progress. Has no effect if there is no XRef edit in progress.
Input
bSaveChanges appName
If true, then any changes to the external part will be saved out to the external file. This is the default, and is normal Mechanical Desktop behavior. Optional; name of application to perform the function.
pObjKey
This function gets the document associated with the key. Every key is associated with at most one document.
Input
pAmiBase
Output
Pointer to an MCAD API object (e.g. a key). Pointer to the document associated with the input argument.
pDoc
Gets the color override from the object specified by the object key. An error is returned if the object has no color override. NOTE: Currently, this function only works for construction features.
Input
pObjKey color
05/12/2001 Page 85
Returns the database that is actively being edited. This will change as the document changes and as external databases are edited locally (xref edit).
Output
pDB
Returns an array of AcDbObjectId's corresponding to the given object key. It is not guaranteed to work for all key types. It is the callers responsibility to delete the array.
Input
pObjKey
Output
Pointer to key. Number of DbIds in pIdsArray. Array of DbIds to be deleted by the caller.
numIds pIdsArray
execVersion
Version object holding MDT release number. The AmiMDTVersion class consists of three intergers representing the major, minor, and patch numbers for MDT.
Get the version for MDT that last saved the current DWG.
Output
fileVersion
Version object holding MDT release number. The AmiMDTVersion class consists of three intergers representing the major, minor, and patch numbers for MDT.
Retrieves the name for the object specified by the object key. The user is responsible for releasing the memory used by objName. This function is supported for AmiCompDefKey, AmiSceneKey, AmiDwLayoutKey, AmiFeatKey, AmiParamKey, and AmiSketchKey.
Input
pObjKey
Output
objName
05/12/2001 Page 86
Retrieves the state for the object specified by the object key. Macros can be used to retrieve the specific attributes packed into the state. The following #defines can be used to determine the states packed into the return from this function: Parameter States AMI_STATE_PARAM_DRIVEN 0x80000000: externally driven/controlled by a file such as a spreadsheet used for table-driven parts. AMI_STATE_PARAM_INDEP 0x40000000: independent of other parameters. AMI_STATE_PARAM_GLOBAL 0x20000000: is a global parameter. Part States AMI_STATE_PART_ACTIVE 0x00010000: updated and working. AMI_STATE_PART_DIRTY 0x00020000: edited, needs regen. AMI_STATE_PART_ROLLBACK 0x00040000: rolled back, feature edited. AMI_STATE_PART_MAINTENANCE 0x00080000: in maintenance mode. Feature States AMI_STATE_FEAT_STABLE 0x80000000: updated and working. AMI_STATE_FEAT_SUPPRESSED 0x40000000: user suppressed. AMI_STATE_FEAT_VERSIONED 0x20000000: suppressed via table-driven parts. AMI_STATE_FEAT_DIRTY 0x10000000: marked as dirty. AMI_STATE_FEAT_COMPUTEFAILED 0x08000000: feature failed to compute. Both Features and Parameters AMI_STATE_USERCREATED 0x01: user-created, not system-created.
Input
pObjKey
Output
Pointer to the object key. Bit packed representation of the object state . The state attribute location is dependent on the type of key used.
objState
Gets the visibility of the object referenced by the given key. This function is not implemented for all types of keys. Currently, this function only works on: Components (AmiCompKey) Work features (AmiFeatKey, AmiGeomKey) NOTE: For comp keys, the key must be for a "comp in def". In other words, visibility is a property of only those comps that are not contained within other comps. The function, amiGetCompInDef() can be used to convert a comp key to one that meets this criterion.
Input
pObjKey
Output
Pointer to an object key. Returns kTrue if and only if the underlying object has not had visibility turned off.
bVisibilityOn
05/12/2001 Page 87
pAttrib name
The system attribute from which to get the name. The name currently assigned to the system attribute.
Get a string value from the named system variable. It is the caller's responsibility to delete the string when finished.
Input
szValue
String value.
szVarName
Output
value
szVarName
Output
value
szVarName
Output
value
Checks to see whether the object specified by the object key contains a color override. NOTE: Currently, this function only works for construction features.
Input
pObjKey
Output
05/12/2001 Page 88
bHasOverride
Checks if the object referenced by the specified key is directly editable. Returns kTrue if and only if the specified key refers to an active, working database as returned by amiGetCurrentDatabase. If the key is a geometry key, then it must not refer to a boundary of a part or a solid, nor can it be inferred. This function accepts any type of MCADAPI key. If this function returns false, the Amistatus::symbol() will reflect the reason the object is not editable. The following symbols are used with kFalse: kDatabaseUnloaded (xrefd object not loaded) kObjectNotEditable (object is outside of xref edit context) kOk (object is of a type that cant be edited.)
Input
pObjKey
Output
Pointer to the object key. True, object is directly editable; false, otherwise.
editable
Removes the color override from the object specified by the object key. NOTE: Currently, this function only works for constructionfeatures. A warning will be returned if the object has no color override.
Input
pObjKey
Sets the name for the object specified by the object key. An error is returned if the name is the same as that of another object of the same type. This function is currently implemented for feature keys only.
Input
pObjKey
Output
objName
Sets the visibility of the object referenced by the given key. This function is not implemented for all types of keys. Currently, this function only works on Components (AmiCompKey) Work features (AmiFeatKey, AmiGeomKey)
05/12/2001 Page 89
NOTE: For comp keys, the key must be for a "comp in def." In other words, visibility is settable on only those comps that are not contained within other comps. The function amiGetCompInDef() can be used to convert a comp key to one that meets this criterion.
Input
pObjKey bVisibilityOn
Pointer to an object key. The desired visibility setting for the object.
Sets the name on the specified system attribute. In order for a system attribute to be attached to a component definition, the attribute must be named and that name must be unique within the component definition. If the name is not unique or unspecified, an error will be returned when an attempt is made to attach the attribute to a component definition.
Input
pAttrib pName
The system attribute to set the name on. The name to assign to the system attribute.
szVarName value
szVarName value
szVarName value
Starts an XRef edit on the given leaf node component for an external part. This function will fail if there is already an XRef edit in progress.
Input
pCompKey bWithDimming
Pointer to (leaf) comp key for an external part. This is the comp that will be become the active leaf node. If true, then UI "dimming" of entities not in the edit will be used. This is the default, and is normal XRef editing behavior.
Parametric Modeling
The following functions are Mechanical Desktop part and assembly modeling-specific functions:
Parameter Handling
AmiStatus amiCreateParam (AmiParamKey*& pParamKey, const char* pName, const char* comment, const char* pExp, AmiPartKey* pPartKey = NULL , const char* appName = Designer )
Creates either a global or local parameter with the information passed in.
Input
Name of the parameter. Comment of the parameter. Expression for the parameter. Pointer to part key to which to attach parameter when creating a local parameter. A global parameter is created if pPartKey is NULL. Name of related application. Pointer to the parameter key.
pParamKey
AmiStatus amiEvalParamExpress (const char* pExpression, double& result, AmiPartKey* pPartKey = NULL, const char* appName = Designer)
pExpression Pointer to an expression. pPartKey If NULL, the expression is checked in the global scope only. If non NULL, the expression is checked in both the global scope and in the scope of the part.
Output
result
Return
AmiStatus amiGetGlobalParams ( int& size, AmiParamKey**& pParamKeys, const char* appName = Designer )
05/12/2001 Page 91
Returns keys to all the global parameters. It is the callers responsibility to release all the keys in the array and delete the array.
Input
appName
Output
Name of application being queried. Number of keys returned. Array of pointers to keys to global parameters.
size pParamKeys
AmiStatus amiGetParamComment
( AmiParamKey* pParamKey, char*& comment ) Gets the comments associated with the parameter defined by the given key. It is the callers responsibility to delete the string returned.
Input
comment
Comment of the parameter. If parameter has no comment set, a null string is returned. This is not an error situation.
AmiStatus amiGetParamDeps ( AmiParamKey* pParamKey, int& size, AmiParamKey**& pParamKeys ) Returns keys to all parameter objects that affect the computation of the given parameter. It is the callers responsibility to release all the keys in the array and delete the array. Input
pParamKey
Output
Pointer to parameter key to application parameter. Number of keys returned. Array of pointers to keys to parameters that affect the computation of the parameter.
size pParamKeys
given
Returns the current expression associated with the parameter. It is the callers responsibility to delete the string indicated by pExpression that is returned.
Input
pParamKey
Output
pExpression
pParamKey
Output
Pointer to parameter key to application parameter. Pointer to parameter name (to be deleted by caller).
name
05/12/2001 Page 92
Returns keys to all parameter objects that depend on the specified parameter. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pParamKey
Output
Pointer to parameter key to application parameter. Number of keys returned. Array of pointers to keys to all parameter objects that depend on the specified parameter.
size pParamKeys
Returns the current value associated with the parameter. The returned value is calculated by evaluating the expression associated with the parameter.
Input
pParamKey
Output
value
AmiStatus amiSetParamComment
( AmiParamKey* pParamKey, const char* pComment ) Sets the value of the parameter comments associated with the given key.
Input
pParamKey The parameter to modify. pComment The new comment string for the parameter. If a null string is passed in the existing comment is removed.
AmiStatus amiSetParamExpress ( AmiParamKey* pParamKey, const char* pExpression )
pParamKey pExpression
Sets the expression associated with the parameter to the value passed in.
Input
pParamKey value
Pointer to parameter key to application parameter. Value to be associated with the parameter.
05/12/2001 Page 93
Part Handling
AmiStatus amiCreateEmptyPart
(AmiPartKey*& pPartKey, Adesk::Boolean fPartKey = Adesk::kTrue, const char* name = NULL, const char* appName = Designer) Creates a new empty part.
Input
If true, returns a part key to the new part. The name of the new part (optional). The name of the new application handling implementation of creation of the new part and owning key (optional). Key to the new part (optional).
pPartKey
AmiStatus amiGetActivePart
( AmiPartKey*& pPartKey, char* appName = Designer ) Returns a key to the active part. It is the callers responsibility to release the key.
Input
appName
Output
pPartKey
Returns key to the part which contains the object referred to by the key passed in. (If the object is not owned by any part, pPartKey is set to NULL.) By passing a key to boundary geometry, work geometry, constraint, feature, parameter, or sketch in a parametric part as input, a part key to the parametric part is returned. It is the callers responsibility to release the key.
Input
pObjKey
Output
Pointer to object key. Pointer to body key to the parametric part that contains the object specified, or NULL if object is not owned by a parametric part.
pPartKey
pPartKey state
Output
Pointer to part key. Bit field allows control over the feature states allowable in the features returned by this function. Number of features in the part.
numFeats
AmiStatus amiGetPartFeats ( AmiPartKey* pPartKey, int& size, AmiFeatKey**& pFeatKeys, Adesk::UInt32 state = Ami::kAll )
05/12/2001 Page 94
Returns keys to all the parts features in regeneration order. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pPartKey state
Pointer to part key. Bit field allows the returned feature set to be thinned out based on each features current state. The argument is specified by combining (ORing) together values from the Ami::FeatState enumeration. Number of keys returned. Array of pointers to keys to features in the part.
Output
size pFeatKeys
Returns keys to all the parameters associated with a given part. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pPartKey
Output
Pointer to part key. Number of keys returned. Pointers to parameter keys to part parameters.
size pParamKeys
pPartKey
Output
Pointer to part key. State of the part referenced by the key passed in. It may be active and stable, active edited, inactive but affected by toolbody editing, possibly affected by current toolbody editing, or in a maintenance mode.
mState
AmiStatus amiGetPartWorkAxes
( AmiPartKey* pPartKey, int& size, AmiGeomKey**& pGeomKeys ) Returns geometry keys to all of the work axes associated with a given part. It is the caller's responsibility to release all the keys in the array and delete the array.
Input
pPartKey
Output
Pointer to part key. Number of keys returned. Array of pointers to geometry keys referring to all of the work axes associated with the part.
size pGeomKeys
AmiStatus amiGetPartWorkPlanes
05/12/2001 Page 95
Returns geometry keys to all of the work planes associated with a given part. It is the caller's responsibility to release all the keys in the array and delete the array.
Input
pPartKey
Output
Pointer to part key. Number of keys returned. Array of pointers to geometry keys referring to all of the work planes associated with the part.
size pGeomKeys
AmiStatus amiGetPartWorkVertices
( AmiPartKey* pPartKey, int& size, AmiGeomKey**& pGeomKeys ) Returns geometry keys to all of the work points associated with a given part. It is the caller's responsibility to release all the keys in the array and delete the array.
Input
pPartKey
Output
Pointer to part key. Number of keys returned. Array of pointers to geometry keys referring to all of the work points associated with the part.
size pGeomKeys
Finds all sketches associated with the specified part that have not been consumed and returns an array of keys to them It is the callers responsibility to release all the keys in the array and delete the array.
Input
pPartKey
Output
Pointer to part key. Number of sketch keys returned. Pointer to an array of pointers to keys to all the unused sketches found.
numSketches pSketchKeys
Rolls the part back to the point just before the specified feature is created. Use "amiRegen" to roll the part all the way forward.
Input
pPartKey pFeatKey
Pointer to part key refers to the part that is to be rolled back. Pointer to feature key refers to the reference feature. The part is rolled back to the point just before this feature is created.
Regeneration Control
AmiStatus amiRegen ( AmiObjectKey* pKey, Adesk::Boolean fForce = Adesk::kFalse )
Regenerates the specified Mechanical Desktop object. If the object has been marked for update, then this function will regen the object. The force-flag can be used to force a regen. This function does
05/12/2001 Page 96
not necessarily update the display to bring it into sync with the object (update of the displayed graphics is often done at end-of-command following a regen). Not all objects can be regenerated directly. For example, amiRegen() returns eNotApplicable for feature keys and constraint keys. Instead, the part or assembly should be regenerated with respect to these objects.
Input
pKey fForce
Pointer to an object key. Force regen even if internal states indicates that regeneration is not necessary (i.e. object not marked for update).
objType fForce
The type of objects to be regenerated, represented as a key type. Force regen even if not necessary.
Tags the internal state of the specified Mechanical Desktop object to indicate that the object is not upto-date and requires regeneration.. Supported only for AmiFeatKey, AmiParamKey, AmiSketchKey and AmiDwVwKey.
Input
pKey
Suppression Control
AmiStatus amiIsFeatSuppressed
(AmiFeatKey* pFeatureKey, Adesk::Boolean& isSuppressed) Returns a boolean stating whether or not the specified feature is currently suppressed.
Input
pFeatureKey
Output
isSuppressed
Suppresses regeneration of the specified feature and all features that directly or indirectly depend on it.
Input
pFeatureKey
AmiStatus amiSuppressFeatsByType (AmiFeatType featType, AmiPartKey* pPartKey = NULL, char* appName = Designer)
Suppress regeneration of all features on the given part or on all parts of the specified feature type.
Input
featType
pPartKey Pointer to a part key (NULL means all parts). appName Name of application to delegate to (used only if the part key is NULL). Note The feature types that can be suppressed in this manner have some limitations. For example, drilled holes by themselves cannot by suppressed, only holes in general. Also, base features cannot be suppressed. Allowable feature types in this call are kHole, kExtrusion, kRevolve, kChamfer, kFillet, kSweep, kArray, kSurfCut, kShell, kParametricBool, kWorkAxis, kWorkPlane, kLoft, and kDraft.
AmiStatus amiUnsuppressFeat ( AmiFeatKey* pFeatKey, Adesk::Boolean bWithDependents = Adesk::kTrue) Resumes regeneration of the specified feature. Input
pFeatKey bWithDependents
AmiStatus amiUnsuppressFeatsByType ( AmiFeatType featType, AmiPartKey* pPartKey = NULL, char* appName = Designer )
Resume regeneration of all features on the given part or on all parts of the specified feature type.
Input
featType Feature type to unsuppress. pPartKey Pointer to a part key (NULL means all parts). appName Name of application to delegate to (used only if the part key is NULL). Note The feature types that can be unsuppressed in this manner have some limitations. For example, drilled holes by themselves cannot by unsuppressed, only holes in general. Also, base features cannot be unsuppressed. Allowable feature types in this call are kHole, kExtrusion, kRevolve, kChamfer, kFillet, kSweep, kArray, kSurfCut, kShell, kParametricBool, kWorkAxis, kWorkPlane, kLoft, and kDraft.
AmiStatus amiUnsuppressPartFeats (AmiPartKey* pPartKey = NULL, char* appName = Designer)
Resumes regeneration of any suppressed features on the given part of on all parts.
Input
pPartKey appName
Pointer to a part key (NULL means all parts). Name of application to delegate to (used only if the part key is NULL).
( AmiCompKey*& pCompKey, AmiCompDefKey* pDefKey, AmiCompDefKey* pOwnerKey, const AcGeMatrix3d& matrix ) Adds a component to a component definition by providing the definition for the component to be added. The owner component definition must not be a leaf node nor may it be external. A matrix is to be supplied to position the component in WCS. The component key for the newly created component is created and returned. It is the callers responsibility to release the memory associated with the component key.
Input
05/12/2001 Page 98
Pointer to the component definition key for the component being inserted. Pointer to the component definition where the first component will be inserted. WCS position for the component.
pCompKey
AmiStatus amiCopyCompDef
(AmiCompDefKey* pCompDefKey, AmiCompDefKey*& pNewCompDefKey, const char* compDefName = NULL) Copies the component definition to a new one with the given name. Returns eInvalidName if the name is not syntactically correct and eNameAlreadyExists if there is already a component definition with that name. If the name argument is NULL, then the next available component definition name is used. Applicable only for leaf node component definitions.
Input
pCompDefKey compDefName
Output
Pointer to component definition key. Name of component of the given key. Key to the newly created component definition.
pNewCompDefKey
AmiStatus amiCreateCompDef ( AmiCompDefKey*& pCompDefKey, AmiBodyKey* pBodyKey = NULL, const char* name = NULL, const char* appName = Designer_Assemblies )
Creates a component definition from a given body key. Because Mechanical Desktop no longer allows component definitions based on solids, this function converts AutoCAD solids to Desktop Parts before creating the component definition. An error will be returned if the passed-in name is invalid. The user can provide a name for the created component definition. Otherwise, if the name is NULL, a default name will be used. Passing a NULL value for the pBodyKey parameter will create an empty component definition (subassembly). This new component definition can now have components inserted into it with amiAddCompToCompDef (). The AmiBodyKey passed-in will be consumed by the new component definition and become invalid. The caller is responsible for erasing the key.
Input
The pointer to the body key. Name of the new component definition. Name of application to perform the function.
Creates a component definition from a given filename. The file needs to be a DWG file type. The file does not need to be a Mechanical Desktop part. A name can be provided if the filename wont be used as the component definition name. Providing a NULL value for the name will default to the
05/12/2001 Page 99
filename as the component definition name. An error status will be returned if the filename is invalid. The caller is responsible for erasing the key.
Input
Name of file. Name of the new component definition. If the name is NULL, the filename will be used as the component definition name. Name of the application to perform the function.
pCompDefKey Pointer to the component definition key whose component definition is to be externalized. pFileName Name of the new file in which the component definition is to be stored.
AmiStatus amiGetActiveCompDef ( AmiCompDefKey*& pCompDefKey const char* appName = Designer_Assemblies )
Returns the definition of the component that is the current edit target. It is the callers responsibility to release the key.
Input
appName
Output
Retrieves all the component definitions that exist in the current database. This list does NOT include the master component definition. It is the callers responsibility to release all the keys in the array and delete the array.
Input
appName
Output
Name of the application to perform the function. Number of keys returned. The pointer to an array of pointers to component definition keys.
size pCompDefKeys
AmiStatus amiGetAllInstances (AmiCompDefKey* pDefKey, AmiCompDefKey* pScopeKey, int& numInstances, AmiCompKey** pInstances)
A convenience function to get all instances (components) of a given component definition. Only those instances (components) within the given subassembly (scope) are returned. All of the components returned will be "focused" to the given scope (i.e. they will be components in the assembly defined by the component definition referenced by pScopeKey. If pScopeKey is NULL, then the master assembly is used.
05/12/2001 Page 100
Input
pDefKey pScopeKey
Output
Component definition for which instances are returned. Context/scope for the search for instances. Only instances within this subassembly will be returned. If NULL, then the master assembly is used. Number of instances returned. Array of pointers to keys for the instances. It is the caller's responsibility to release() the keys in the array and delete the array.
numInstances pInstances
Returns key to a body associated with the definition of a leaf node component. If the component definitions is not that of a leaf node, or if a body is not associated with the leaf node, the pointer to the body key is set to NULL. It is the callers responsibility to release the key.
Input
pBodyKey
Pointer to body key to body associated with the component definition specified or NULL if not applicable.
Returns keys to all components used by a component definition. It is the callers responsibility to release all the keys in the array and delete the array.
Input
size pCompKeys
Number of keys returned. Array of pointers to component keys used by component definition.
AmiStatus amiGetCompDefName
( AmiCompDefKey* pCompDefKey, char*& compDefName, const Adesk::Boolean& fullPath = Adesk::kFalse ) Returns the name of the component definition. If fullPath is true and the component definition is external, the full path to the file will be returned. The caller is responsible for releasing the memory for compDefName.
Input
pCompDefKey The pointer to the component definition key. fullPath If true, and the component definition is external, the full path to the file will be returned.
Output
Returns a pointer to a component definition key that represents the database's master component definition. This function can be used to obtain the master compdef of any loaded databases for the current document (i.e. the host database and any loaded XRefd databases.) It is the callers responsibility to release the key.
Input
pDb appName
Output
The database to get the master of. If not provided, the host database is used. Name of the application to perform the function. If not provided, the default application is Designer_Assemblies.
pPartKey
Output
pDefKey
AmiStatus amiIsCompDefExternal
( AmiCompDefKey* pCompDefKey, Adesk::Boolean& external ) Checks if the component definition is an external definition. The output argument is true if and only if the component definition refers to an external object (with respect to the host database). If the component definition object itself is internal, but is used to reference an external subassembly or part, then a warning status of kExternalAttachment is returned (in addition to the argument being true). This warning status is used for any component definition that resides in one database but refers directly to a subassembly or part in another database.
Input
external
AmiStatus amiIsCompDefLeafNode
( AmiCompDefKey* pCompDefKey, Adesk::Boolean& leaf ) Checks if the component definition is that of a leaf node.
Input
pCompDefKey
Output
The pointer to the component definition key. True, if the component definition is a leaf node; false, if the component definition is not a leaf node.
leaf
AmiStatus amiIsCompDefMaster
( AmiCompDefKey* pCompDefKey, Adesk::Boolean& master ) Checks if the given component definition is the master definition.
Input
master
pCompDefKey Pointer to the component definition key whose component definition is to be localized.
AmiStatus amiReassignComps ( int numCompsToReassign, AmiCompKey** compsToReassign, AmiCompDefKey* pTargetDef )
Reassigns the given components to the indicated component definition. This function is overloaded to allow for specification of the target component definition using a component key. When the target is a component instead of a component definition, then constraints on that component will be favored over others when it is it is not possible to preserve all constraints. In general, assembly constraints are preserved wherever possible, but if the target definition is instanced, then it is best to supply a target component.
Input
The length of the array in referenced in the second argument. An array of pointers to component keys for components to be reassigned to the new owning (target) component definition. Specification of the target component definition. If a component key is supplied, then the definition of that component will be the target definition.
The length of the array in referenced in the second argument. An array of pointers to component keys for components to be reassigned to the new owning (target) component definition. Specification of the target component definition. If a component key is supplied, then the definition of that component will be the target definition.
Removes a component from a component definition. An error is returned if the component does not exist within the component definition.
Input
pCompKey pOwnerKey
The pointer to the component key to be removed. The pointer to the component definition key from which the component will be removed.
Sets the current edit target component to that referenced by the given key.
Input
pCompDefKey
AmiStatus amiSetCompDefName
( amiCompDefKey* pCompDefKey, const char* compDefName ) Sets the name of the component definition. An error status is returned if the name is invalid.
Input
pCompDefKey compDefName
The pointer to the component definition key. Name to be given to component definition.
Component Handling
AmiStatus amiGetActiveAssembly
( AmiCompKey*& pCompKey, const char* appName ) Returns the currently active assembly as a component key. If the master assembly is the currently active assembly, then an error of type kNullKey is returned (since there is no component for the the master assembly).
Input
appName
Output
(Optional.) Name of the app to get the active assembly. Pointer to created comp key. Must be released by caller when done using it.
pCompKey
AmiStatus amiGetActiveLeafNode
( AmiCompKey*& pCompKey, const char* appName = Designer_Assemblies ) Returns the current active part as a component key.
Input
appName
Output
Name of the application to get the active part instance. If NULL, assume Assemblies.
pCompKey Pointer to created (leaf) component key. Must be freed by caller when done using it.
AmiStatus amiGetCompChildren
( AmiCompKey* pCompKey, long& size, AmiCompKey**& pCompKeys ) Returns a pointer to an array of component key pointers to the immediate (first level) subcomponents of the given component. It is the callers responsibility to release the keys.
Input
pCompKey
Output
The pointer to the component key. Number of component key pointers being returned. A pointer to an array of component key pointers.
size pCompKeys
Gets the components definition. It is the callers responsibility to release the key..
Input
pCompKey
Output
Given a key to a component returns the key to the component which is its corresponding component in its space of definition. For example, suppose a component is a subassembly made of one bolt and two nuts (lets call it NB). NB could be instanced in several other subassemblies in a model. If you have a component key, N1, that refers to one of the nuts in one of the instances of NB, say NB1, you might want to go edit the definition of NB to remove the nut leaving only one nut and one bolt in NBs definition. If amiGetCompInDef is called and N1 is passed in, a new key, N1A, will be returned, which is the key to that nut in NBs definition. N1A, could be used in a call to amiRemoveCompFromCompDef to remove that nut from NBs definition. To perform this call, you would also need to pass in NBs definition, which could be obtained by calling amiGetCompOwner passing N1 in. It is the callers responsibility to release the key.
Input
pCompKey1
Output
The pointer to the component key. Pointer to the corresponding component key.
pCompKey2
AmiStatus amiGetCompName
( AmiCompKey* pCompKey, char*& compName ) Retrieves the name for the component specified by the component key. The caller is responsible for releasing the memory used by compName.
Input
pCompKey
Output
The pointer to the component key. Name of component of the given key.
compName
AmiStatus amiGetCompOwner
( AmiCompKey* pCompKey, AmiCompDefKey*& pCompDefKey ) Gets the definition to the component owning the component passed-in. The caller is responsible for erasing the component definition key.
Input
pCompKey
Output
( AmiCompKey* pCompKey, AcGeMatrix3d& matrix ) Returns the current WCS position of the component.
Input
pCompKey
Output
The pointer to the component key. Actual position of component in current WCS space.
matrix
AmiStatus amiGetContainingComp
( AmiObjectKey* pObjKey, AmiCompKey*& pCompKey ) Returns a key to the component which contains the object referred to by the key passed in (if the object is not contained by any component, pCompKey is set to NULL).
Input
pObjKey
Output
pCompKey
AmiStatus amiSetActiveAssembly
( AmiCompKey* pCompKey ) Sets the current edit target component to that referenced by the given key. The component key should be for a non-leaf component (i.e. an assembly). Also, that assembly must be in the database that is currently open for edit (use amiStartExternalEdit / amiEndExternalEdit to start/stop Xref Edits).
Input
pCompKey
AmiStatus amiSetActiveCompDef
( AmiCompDefKey* pCompDefKey )
Sets the current edit target component to that referenced by the given key.
Input
(AmiCompKey*& pCompKey ) Sets the current active part. The component key must be for a leaf component (i.e. a part instance). Furthermore, the component key must be for a component in the current active component definition. If this requirement is not met, then an error status of kUnmatchedActiveContext is returned. If an attempt is made to transition to or from an external (XRef) part, this function fails, returning kExternalDef. Separate functions are provided for starting and ending XRef edits.
Input
pCompKey
Pointer to (leaf) comp key. This is the component that will become the current edit target.
AmiStatus amiSetCompName
( AmiCompKey* pCompKey, const char* compName ) Sets the name for the component specified by the component key. An error status is returned if an invalid name is passed-in. NOTE: The name of a component that stems from an external file can be changed during the drawing session. However, the same change is not persistent and will revert during the next file loading.
Input
pCompKey
Output
compName
AmiStatus amiSetCompPosition
( AmiCompKey* pCompKey, const AcGeMatrix3d& matrix ) Sets the component to the new WCS position. All instances of the component will also update accordingly.
Input
pCompKey matrix
The pointer to the component key. New WCS position for the component.
csAttDisplayId
AcDbObjectId
Dimensions
csSkAnglePoint
AcGePoint3d
csAttMaxOperands
Int
All
csAttOperand2 csAttOrientation2
AmiGeomKey* AmiNormalOrientnType
AmiGeomKey AmiNormalOrientnType
Minimum number of operands the constraint requires during construction. All The first operand used by the constraint. All The orientation of the normal for the first operand, whether it is reversed or based on the raw data from the model. All The second operand used by the constraint. All The orientation of the normal for the second operand, whether it is reversed or based on the raw data from the model. Mirror constraint The geometry around which operand 2 mirrors operand 1. if The orientation of the normal for the csAttGeometryOf axis of symmetry. Symmetry has a value
In the tables below, the second column describes any constraints on allowable values for the specified attribute. The third column, labeled Role in constraint creation indicates if the attribute must have a non-NAV value when the descriptor is used to create a new view. If this entry is blank, then the attribute is optional and can be NAV. The fourth column indicates if the attribute is read-only, writeonce, or read/write (this last case is indicated by a blank entry in column four).
mandatory
mandatory Mandatory if csAttMaxOpe rands > 1, not allowed if csAttMaxOpe rands < 2
csAttOrientation2
Sketch constraints define absolute relationships between geometry which is non-parametric in nature. These are relationships such as parallel, concentric and tangency. Thus the parametric attribute does not apply. These are also non-displayable at this point.
csAttConstrType
Sketch constraints (eSkCircleCoincidence, eSkPointCurveCoincidence, eSkCenterPoint, eSkHorizontal, eSkVertical, eSkParallel, eSkColinear, eSkPerpendicular, eSkProjection, eSkPointCoincidence, eSkCoincident, eSkConcentric, eSkTangent, eSkXEqual, eSkYEqual, eSkEqualRadius, eSkEqualLength, eSkMirror) kFalse 1 or 2 1 or 2 AmiGeomKey to constrained geometry AmiNormalOrientnType (kRaw, kReversed) AmiGeomKey to constrained geometry
mandatory
Write-once
Read-only Read-only Read-only mandatory Mandatory if csAttMinOper ands > 1, not allowed if csAttMaxOpe rands < 2
Sketch dimensions specify parametric relationships between geometry. They can be displayed by a dimension object, optionally through the API. Thus most of the control for display applies to these constraints. Table 4: Constraint Attribute Keywords - Sketch Dimensions
Name Allowable Values Role in constraint creation mandatory Settable through API ?
csAttConstrType
Sketch dimensions (eSkDistance, eSkAngle, eSkRadius, eSkHorDistance, eSkVerDistance, eSkAlignDistance, eSkDiameter, eSkEllRadiusMajor, eSkEllRadiusMinor, eSkAlignDiamDistance, eSkOrdXBase, eSkXOrdDistance, eSkOrdYBase, eSkYOrdDistance, eSkParaDistance) Any expression, numeric or parameter key AcGePoint3d location for dimension display Adesk::Boolean AcDbObjectId of dimension if csAttDisplayed = kTrue kTrue AcGePoint3d point within the angle being dimensioned
Write-once
Read-only Read-only Mandatory if csAttConstrTy pe=eSkAngle Read-only Read-only mandatory Mandatory if csAttMinOper ands > 1, not allowed if csAttMaxOpe rands < 2
csAttOrientation2
Extracts the value for an attribute. This function is overloaded for all return types needed to support the current set of constraint attributes. These types are: AmiObjectKey* AcGePoint3d AmiValue double char* int Adesk::Boolean AcDbObjectId AmiNormalOrientnType AmiConstraintType The keywords for attributes are defined by the AmiConstrAttribute enum. The Constraint Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. If the value for the attribute is NAV, meaning "Not A Value", then eAttValueNAV is returned as the AmiStatus and the content of the 'value' is undefined. It is the caller's responsibility to free, as appropriate, any returned value.
Input
pConstrDescrip A pointer to the descriptor. attr Keyword for attribute (passed as an enum).
Output
value
AmiStatus amiSetData
( AmiConstrDescrip* pConstrDescrip, AmiConstrAttribute keyword, <Input Type> value )
Sets an attribute value from the given constraint descriptor. This function is overloaded for all input types needed to support the current set of constraint attributes. These types are: AmiObjectKey* AcGePoint3d AmiValue double char* int Adesk::Boolean AcDbObjectId AmiNormalOrientnType AmiConstraintType The keywords for attributes are defined by the AmiConstrAttribute enum.The Constraint Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. In addition, the special value Ami:att_NAV can be used to set the specified attribute to "Not A Value". NAV attributes are treated as "unset" or "don't care" values when applying the descriptor to a constraint.
Input
pConstrDescrip A pointer to the descriptor. attr Keyword for attribute (passed as an enum). value The value for the specified attribute.
05/12/2001 Page 110
Creates a constraint as defined in the descriptor, using the specified type and given geometry key(s). If csAttLocation has a value that placement will be used, but a default placement will be created if one is not given. csAttDisplayed controls whether the display entity is created. If csAttParametric has a value (either a number, an expression or a parameter key) it will be used with parametric constraints. If none is given, a parameter using the system defaults (0.0 for assembly constraints, the current distance for sketch dimensions) will be created and used. Part scope is determined from the principal and auxiliary operands on the constraint descriptors. Both keys (if two are given) must supply the same part instance, otherwise a no common part error is returned. Input points (e.g. placement points) are assumed to be in the coordinate space of the part instance provided. If the keys are in the scope of the part, then the input points are assumed to be in part coordinate space. A key to the newly created constraint can optionally be returned. It is the caller's responsibility to release that key. When creating angle constraints the display location given in the descriptor is required, and is used to determine which of the possible four angles to constrain.
Input
pDescrip createKey
Output
The pointer to the constraint descriptor. Flag indicating whether a key to the new constraint should be created and returned. A pointer to the constraint key.
pConstrKey
AmiStatus amiCreateConstraints (AmiConstrDescrip** pDescrips, int numDescrips, Adesk::Boolean createKey = Adesk::kFalse AmiConstrKey*** pConstrKeys = NULL )
Creates many constraints based on the information given in the constraint descriptors. The constraints are added, followed by a single solve of all of them, avoiding the expense of multiple solves. In the case of failure, the keys array will have a null pointer in any argument where the creation failed, and the status will return both a warning and the status for the last failure that occurred. Keys to the newly created constraints can optionally be returned. When creating angle constraints the display location given in the descriptor is required, and is used to determine which of the possible four angles to constrain.
Input
The pointer to an array of descriptors describing the constraints to be created. Number of descriptors passed in, and number of constraint keys returned. Flag indicating whether keys to the new constraint should be created and returned. A pointer to an array of constraint keys.
pConstrKeys
AmiStatus amiCreateConstrDescrip ( AmiConstraintType constrType, AmiConstrDescrip*& pConstrDescrip, const char* appName = NULL )
Returns an empty constraint descriptor of the given type. An "empty" constraint descriptor is a descriptor where all values are NAV.
Input
constrType
appName
Output
Name of related application. If NULL is specified then a default application will be used. A pointer to an empty descriptor.
pConstrDescrip
AmiStatus amiGetConstrDescrip
( AmiConstrKey* pConstrKey, AmiConstrDescrip*& pDescrip)
Returns a descriptor for the given constraint. The descriptor holds information on the current state of the constraint. The descriptor is de-coupled from the constraint (it does not change as the constraint changes).
Input
pConstrKey
Output
pDescrip
AmiStatus amiGetConstrOperands ( AmiConstrKey* pConstrKey, AmiGeomKey*& pOp1, AmiGeomKey*& pOp2 ) Returns keys to the geometric objects operated upon by the given constraint. It is the callers responsibility to release the keys. Input
pConstrKey
Output
The pointer to a component constraint key. Key to first geometric object. Key to second geometric object.
pOp1 pOp2
Returns key to the parameter associated with a given constraint. It is the callers responsibility to release the key.
Input
pConstrKey
Output
The pointer to the constraint key. A pointer to the parameter key for the constraint key.
pParamKey
Returns the constraint type. Constraint types are defined in header file miconstr.h.
Input
pConstrKey
Output
type
pConstrKey
Output
value
Returns the location point used to display the dimension of a dimensional constraint.
Input
pConstrKey
Output
The pointer to the dimensional constraint key. The location point used in the display of the dimension.
locPoint
Sets the expression associated with the constraint. If the constraint does not have an associated expression (e.g., line/line mating) then an error is returned.
Input
pConstrKey valExpr
Sets the distance or angle value of the constraint. If setting a constraint value is not applicable (i.e., line/line mating), an error is returned.
Input
pConstrKey value
The pointer to the constraint key. The distance or angle (in radians) offset.
pConstrKey
Output
pCompKey1 A pointer to the first component key (determined by birthday). pCompKey2 A pointer to the second component key.
AmiStatus amiGetConstrsActingOnComp ( AmiCompKey* pCompKey, long& size, AmiCompConstrKey**& pConstrKeys )
Returns a pointer to an array of component constraint keys for the constraints that play an active part in positioning the component. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pCompKey
Output
size pConstrKeys
Number of pointers to constraint keys. A pointer to an array of pointers to component constraint keys to constraints that contribute to the component position.
AmiStatus amiGetConstrsFromComp ( AmiCompKey* pCompKey, long& size, AmiCompConstrKey**& pConstrKeys ) Returns a pointer to an array of component constraint keys for the given component. It is the callers responsibility to release all the keys in the array and delete the array. Input
pCompKey
Output
The pointer to the component key. Number of pointers to constraint keys. A pointer to an array of pointers to component constraint keys.
size pConstrKeys
Sketch Handling
AmiStatus amiGetBrepGeomFromSketchGeom ( AmiGeomKey* pSketchGeomKey, AmiGeomKey*& pBrepGeomKey )
A sketch can reference B-rep geometry from the part. The referenced geometry may be projected onto the appropriate sketch plan. But as the B-rep geometry changes, so does the sketch. For sketch geometry, retrieved from amiGetSketchGeom, this function will return the B-rep geometry that defines that sketch geometry.
Input
pSketchGeomKey
Output
pBrepGeomKey
Returns all constraints that act simultaneously upon geometry contained by the specified sketch and geometry not contained in the sketch. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pSketch
Output
Pointer to sketch key. Number of keys returned. An array of pointers to keys to constraints that affect geometry contained by the sketch and geometry not contained in the sketch.
size pConstraints
AmiStatus amiGetFeatsFromSketch
(AmiSketchKey* pSketch, int& numFeats, AmiFeatKey**& pFeatKeys, Adesk::UInt32 state, Adesk::Boolean fReturnComposite )) Finds the features which were created from the specified sketch.
Input
pSketchKey
state fReturnComposite
Bit field allows control over the feature states allowable in the features returned by this function. If a feature bringing about this geometry is contained in a composite feature, a value of true will cause the composite to be returned. False will return the innermost feature.
Output
numFeats Number of keys in resulting array. pFeatKeys Array of features created from the sketch.
AmiStatus amiGetPathStartPoint ( AmiSketchKey* pSketch, AmiPointKey*& pPoint )
pSketch
Output
Pointer to sketch key. The sketch referred to by this key must be a 2D or 3D path. The start point of the path.
pPoint
Returns all constraints that affect geometry contained by the specified sketch. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pSketch
Output
Pointer to sketch key. Number of keys returned. An array of pointers to keys to constraints that affect geometry contained by the sketch and geometry not contained in the sketch.
size pConstraints
Returns the transformation matrix that maps from sketch coordinate system to the global coordinate system.
Input
pSketchKey
Output
coordSys
Returns a key to the plane of a closed profile. Any other kind of sketch is considered invalid. It is the caller's responsibility to release the plane key.
Input
pSketch
Output
pPlaneKey
AmiStatus amiGetSketchesFromGeom
( AmiGeomKey* pGeom, int& numSketches, AmiSketchKey**& pSketchKey, char* appName = Designer ) Finds all sketches associated with the specified geometry. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pGeom appName
Output
Pointer to geometry key. Name of application being queried. Number of related sketches found. Array of pointers to sketch keys.
numSketches pSketchKey
AmiStatus amiGetSketchGeom ( AmiSketchKey* pSketch, int* pSize = NULL, AmiGeomKey*** pGeom = NULL, int* pPointSize = NULL, AmiPointKey*** pPointGeom = NULL, int* pSupportSize = NULL, AmiGeomKey*** pSupportGeom = NULL )
Returns all geometric objects used by the specified sketch. It is the callers responsibility to release all the keys in the arrays and delete the arrays.
Input
pSketch
Output
pSize pGeom
Number of keys returned. (Optional.) Array of pointers to keys to all the geometry that constitutes the profile, path or cutline. (Optional.) pPointSize An optional return of the number of point geometry keys returned. pPointGeom An optional array of pointers to keys to all of the support geometry included in the sketch, which is used to help constrain or construct the resulting feature. pSupportSize An optional return of the number of support geometry keys returned. pSupportGeom An optional array of pointers to keys to all the support geometry included in the sketch, which is used to help constrain or construct the resulting feature.
AmiStatus amiGetSketchParams ( AmiSketchKey* pSketch, int& size, AmiParamKey**& pParams )
Returns all parameter objects related to the specified sketch. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pSketch
Output
Pointer to sketch key. Number of keys returned. Array of pointers to keys to all parameters related to the sketch.
size pParams
Input
pSketchKey
Output
sketchType
( AmiSketchConstrKey* pConstraintKey, int& numSketches, AmiSketchKey**& pSketchKeys ) Finds all sketches that are constrained by the specified sketch constraint. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pConstraintKey
Output
Pointer to a sketch Constraint Key. Number of constrained sketches found. Array of Sketch Key pointers.
numSketches pSketchKeys
Feature Handling
AmiStatus amiAbortCompositeFeat ( const char* appName = Designer )
Aborts composite feature creation erasing the current composite feature and all features that were created from the time the current composite feature was started. An error will be returned if there was no composite feature being created.
Input
appName
AmiStatus amiCreateFeature
( AmiFeatDescrip* pFeatDescrip, AmiFeatKey*& pFeatKey, Adesk::Boolean fFeatKey = Adesk::kFalse ) Creates a feature on the active part using the feature descriptor. It is the caller's responsibility to release the returned key. Note: this function should not be used to create a composite feature. Instead, use amiStartCompositeFeat.
Input
pFeatDescrip fFeatKey
Output
Descriptor to use for feature creation. Set true if a key to the new feature is to be returned. Output feature key if fFeatKey is true.
pFeatKey
Ends composite feature creation closing the current composite feature and returning a key to it. An error will be returned if there was no composite feature being created.
Input
appName
Output
pFeatKey
AmiStatus amiGetConstrGeomDescrip ( AmiGeomKey* pGeomKey, AmiConstrGeomDescrip*& pGeomDescrip, Adesk::Boolean fReturnParameters = Adesk::kFalse, Adesk::Boolean fRetainKey = Adesk::kFalse, char* appName = Designer )
Creates a constrained geometry descriptor object from a geometry key that refers to a work entity. It is the callers responsibility to release the descriptor object.
Input
Pointer to a valid geometry key. If true, locator values are returned in the form of parameter keys. Otherwise, they are returned as doubles. If true, the descriptor hangs onto a copy of the original geometry key. Creating application name. Pointer to the new descriptor object.
pGeomDescrip
AmiStatus amiGetFeatDepFeats ( AmiFeatKey* pFeatureKey, int& size, AmiFeatKey**& pFeatureKeys, Adesk::UInt32 state = Ami::kAll )
Returns all of the features dependent on a given feature. It is the caller's responsibility to release all the keys in the array and delete the array.
Input
Pointer to feature key. Bit field allows control over the feature states allowable in the features returned by this function. Number of keys returned. Array of pointers to keys to all the features dependent on the given feature.
Returns all of the work entities dependent on a given feature. It is the caller's responsibility to release all the keys in the array and delete the array.
Input
pFeatureKey
Output
size pGeomKeys
Number of keys returned. Array of pointers to keys to all the work entities dependent on the given feature.
Returns curve keys to all the edges associated with a given feature. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pFeatureKey
Output
Pointer to feature key. Number of keys returned. Array of pointers to keys to all the edges associated with the feature.
size pCurveKeys
Returns surface keys to all the faces associated with a given feature. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pFeatureKey
Output
Pointer to feature key. Number of keys returned. Array of pointers to keys to all the faces associated with the feature.
size pSurfKeys
Returns parameter keys to all the parameters directly driving a given feature. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pFeatureKey
Output
Pointer to feature key. Number of keys returned. Array of pointers to keys to all parameters driving the feature.
size pParamKeys
AmiStatus amiGetFeatType
pFeature
Output
featType
AmiStatus amiGetFeatsFromGeom ( AmiGeomKey* pGeomKey, int& size, AmiFeatKey**& pFeatureKeys, Adesk::UInt32 state,, Adesk::Boolean fReturnComposite )
Returns all the features that brought about the specified geometric object. The features are not returned in any specific order. Features are returned in the same scope as the geometry key. For example, if the geometry key references the edge of a hole on a component, a component feature will be returned, defined in the space of that component. If the geometry key references geometry on the part, then part component keys will be returned.
NOTE: Any geom keys created with the allowGhost flag are not supported.
Input
Pointer to geometry key. Bit field allows control over the feature states allowable in the features returned by this function. If a feature bringing about this geometry is contained in a composite feature, a value of true will cause the composite to be returned. False will return the innermost feature.
Number of keys in resulting array. Array of keys to all the features that constitute the specified geometric object.
Output
size pFeatureKeys
Returns all the sketches that are associated with a given feature. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pFeatureKey
Output
size Number of keys returned. pSketchKeys Array of pointers to keys to all the sketches that are associated with the feature key.
AmiStatus amiGetFeatVertices ( AmiFeatKey* pFeatureKey, int& size, AmiPointKey**& pPointKeys )
Returns point keys to all the vertices associated with a given feature. It is the callers responsibility to release all the keys in the array and delete the array.
Input
pFeatureKey
Output
Pointer to feature key. Number of keys returned. Array of pointers to keys to all the vertices associated with the feature.
size pPointKeys
AmiStatus amiGetFeatDescrip ( AmiFeatKey* pFeature, AmiFeatDescrip*& pFeatDescrip, Adesk::Boolean fReturnInformers = Adesk::kFalse, Adesk::Boolean fReturnParameters = Adesk::kFalse )
Creates a feature descriptor object from a feature key. It is the callers responsibility to release the feature descriptor.
Input
Pointer to a feature key. If true, the full feature description is returned including all locators and terminators. Otherwise locators and terminators are not returned. If true, descriptor values are returned in the form of parameters keys. Otherwise, they are returned as doubles. Pointer to new feature descriptor object.
pFeatDescrip
Returns a key to the owning composite feature for the given feature if the given feature is contained in a composite.
Input
PfeatKey
Output
Pointer to feature key. Pointer to a key to the owning composite feature or NULL if the feature is not contained in a composite.
POwningComposite
Checks if the specified feature either matches the type specified or is a kind of the type specified.
Input
pFeature featType
Output
Pointer to a feature key. Feature type to check against. If true, feature matches or derives from the specified feature type.
isType
PFeatKey PDestFeat
Feature to reorder. Feature that the reordered feature will be placed immediately after in the tree.
AmiStatus amiSetCompositeFeatEditCallback (const char* pOwnerInfo, AmiCompFeatEditFcnPtr fcn, const char* appName)
Sets a callback function associated with an owner info string to be called when composite features created with the same owner info string are edited. Note1: The owner info string is a null terminated string made up of three tokens separated by semicolons. The first token should be the owner app's company name. The second token is the name of the creating app. While the third (optional) token is a URL. This owner info string has to be the same string used to create the composite features for the owner's app in order for this to work. Note2: The edit callback is not set on the document. It is global. That means for that for a single application, this call only needs to be made once per session.
05/12/2001 Page 121
Input
pOwnerInfo fcn
User supplied owner info string (see note above). Pointer to the function to be called when composites created with the same owner info string are selected for edit.
Starts composite feature creation. All features created from this point on are considered to be contained by this composite feature until such time that the composite feature creation is ended or aborted. This includes features created via the API, the MDT UI, and ADS. Note: The first volume feature (base) on a part cannot be a composite. The part must have volume before the first composite is created. Note: Only one composite feature per document can be open for create at a given time.
Input
pCompDescrip
Feature Descriptors
AmiStatus amiCreateFeatDescrip
( AmiFeatType featType, AmiFeatDescrip*& pFeatDescrip, char* appName=Designer ) Creates a new empty feature descriptor of the given type. It is the caller's responsibility to release the feature descriptor.
Input
featType
Output
pFeatDescrip
AmiStatus amiGetCombinerType
pFeatDescrip
Output
combType
AmiStatus amiGetDescripType
pFeatDescrip
Output
featType
Gets the base data from a feature descriptor. It is the caller's responsibility to release the returned key.
Input
pFeatDescrip
Output
Pointer to a feature descriptor. Part that the feature was created on.
pPartKey
AmiStatus amiIsDescripKindOf
( AmiFeatDescrip* pFeatDescrip, AmiFeatType featType, Adesk::Boolean& isType ) Checks if the feature descriptor refers to a feature that either matches the type specified or is a kind of the type specified.
Input
pFeatDescrip featType
Output
Pointer to a feature descriptor. Feature type to check against. If true, feature matches or derives from the specified feature type.
isType
pFeatDescrip combType
Sets the part key on a feature descriptor. The given key is copied when this call is made.
Input
pFeatDescrip pPartKey
( AmiCompositeFeatDescrip* pCompDescrip, int& nFeats, AmiFeatKey**& pFeats, int& nParms, AmiParamKey**& pParms, std::string& featType, std::string& ownerInfo ) Gets the data from a composite feature descriptor. Note: The owner info string is a null terminated string made up of three tokens separated by semicolons. The first token should be the owner app's company name. The second token is the name of the creating app. While the third (optional) token is a URL. The owner info string is currently unused but reserved for future use.
Input
nFeats
Array of contained feature keys. Number of param keys in driving parameters array. Array of driving parameter keys. The custom feature type. The owner info string.
Sets the user supplied owner information string on the given composite feature descriptor. Note: The owner info string is a null terminated string made up of three tokens separated by semicolons. The first token should be the owner app's company name. The second token is the name of the creating app. While the third (optional) token is a URL. The owner info string is currently used in registration of the edit callback function.
Input
Sets the user supplied custom feature type on the given composite feature descriptor.
Input
Hole Descriptors
AmiStatus amiClearHoleTapData ( AmiHoleDescrip *pHoleDescrip )
pHoleDescrip
AmiStatus amiGetCBoreHoleData
( AmiCBoreHoleDescrip* pHoleDescrip, AmiValue& cbDepth, AmiValue& cbDiam ) Gets the data from a counter bored hole descriptor.
Input
pHoleDescrip
Output
cbDepth cbDiam
AmiStatus amiGetCSinkHoleData
( AmiCSinkHoleDescrip* pHoleDescrip, AmiValue& csAngle, AmiValue& csDiam ) Gets the data from a counter sink hole descriptor.
Input
pHoleDescrip
Output
Pointer to a counter sink hole descriptor. The counter sink angle (degrees). The counter sink diameter.
csAngle csDiam
AmiStatus amiGetHoleData
( AmiHoleDescrip* pHoleDescrip, AmiValue& diameter, AmiValue& drillAngle, AcGeVector3d& dirVec, char*& psNominalSize, AmiUnits& units ) Gets the data from a hole descriptor.
Input
pHoleDescrip
Output
Pointer to a hole descriptor. The diameter of the hole. Drill point angle (degrees). Hole direction vector. The nominal size. The units of the hole(Ami::kMetric, kEnglish, or kUnknownUnits).
AmiStatus amiGetHoleTapData
( AmiHoleDescrip* pHoleDescrip, Adesk::Boolean& isTapped, Adesk::Boolean& isFull, AmiValue& majorDiam, AmiValue& tapDepth, AmiValue& pitchVal, char*& psPitchDesc, AmiValue& tapDrillDiam, char*& psFitClass) Gets the tap data from a hole feature descriptor.
Input
pHoleDescrip
Output
Pointer to a hole feature descriptor. If true, the hole is tapped. If false, the hole is not tapped and the rest of the output parameters are meaningless. If true, the hole is fully tapped and the tap depth parameter is meaningless. The major diameter. The tap depth.
The pitch. If units = = Ami::kMetric or kUnknownUnits, this is units per thread (e.g. mm/thread). If units = = Ami::kEnglish, this is threads per inch (tpi). The string representation of pitch. Size of the tap drill. String used to specify fit class for the thread.
pHoleDescrip cbDepth
pHoleDescrip cbDiam
pHoleDescrip csAngle
Pointer to hole descriptor to set. New counter sink angle value (degrees).
pHoleDescrip csDiam
pHoleDescrip diameter
pHoleDescrip dirVec
pHoleDescrip drillAngle
Pointer to hole descriptor to set. New drill point angle value (degrees).
PsFitClass
Pitch
The pitch. If units == Ami::kMetric or kUnknownUnits, this is units per thread (e.g. mm/thread). If units == Ami::kEnglish, this is threads per inch (tpi). PsDescription The string representation of pitch.
AmiStatus amiSetHoleTapData ( AmiHoleDescrip* pHoleDescrip, Adesk::Boolean isFull, const AmiValue& majorDiam, const AmiValue& tapDepth )
Pointer to hole descriptor If true, the hole is fully tapped and the tap depth parameter is meaningless. The major diameter. The tap depth.
Sets tap drill diameter on a feature descriptor for a tapped hole. Input PHoleDescrip Pointer to a hole feature descriptor.
05/12/2001 Page 127
Output TapDrillDiam
Sets the units on a hole feature descriptor. Input PHoleDescrip Pointer to a hole feature descriptor. Units The units of the hole(Ami::kMetric, kEnglish, or kUnknownUnits).
( AmiBaseDescrip* pBaseDescrip, AcBrBrep*& pBrep ) Gets the data from a base feature descriptor. It is the caller's responsibility to delete the returned entity. Note The B-rep entity returned from this function corresponds to the stock solid used to create this base feature which is not a database entity. Therefore, although the B-rep API can be used to traverse and inspect the solid object, the MCAD API function amiGetKeyFromBrep will not work on any of the B-rep elements obtained during traversal.
Input
pBaseDescrip
Output
pBrep
Sets the data on a base feature descriptor. The entity is copied when this call is made.
Input
pBaseDescrip pBrep
Extrusion Descriptors
AmiStatus amiGetExtrusionData ( AmiExtrusionDescrip* pExtDescrip, AcGeVector3d& dirVec, AmiValue& draftAngle )
pExtDescrip
Output
Pointer to an extrusion descriptor. Direction vector for extrusion. Extrusion angle (degrees).
dirVec draftAngle
AmiStatus amiGetThinExtrusionData ( AmiThinExtrusionDescrip* pExtDescrip, AmiThicknessType& thickType,AmiValue& thickness1, AmiValue& thickness2, Adesk::Boolean& fExtend )
Thickness type. Thin thickness. 2nd thickness if type is two directions. Extend is on (auto to-next termination).
pExtDescrip dirVec
pExtDescrip draftAngle
Sets the profile to extrude on an extrusion descriptor. The sketch key is copied when this call is made.
Input
pExtDescrip pSketchKey
pExtDescrip Pointer to thin extrusion descriptor to set. fExtend Extend is on (auto to-next termination).
AmiStatus amiSetThinExtrusionThickness (AmiThinExtrusionDescrip* pExtDescrip,AmiThicknessType thickType,const AmiValue& thickness1,const AmiValue& thickness2)
Input
pExtDescrip Pointer to thin extrusion descriptor to set. thickType Thickness type. thickness1 Thin thickness. thickness2 2nd thickness if type is two directions.
Revolution Descriptors
AmiStatus amiGetRevolveData
( AmiRevolveDescrip* pRevDescrip, AcGeVector3d& dirVec, AmiLineKey*& pLineKey ) Gets the data from a revolve descriptor. It is the callers responsibility to release the key returned.
Input
pRevDescrip
Output
dirVec pLineKey
Sets the axis of revolution on a revolve descriptor. The line key is copied when this call is made.
Input
pRevDescrip pLineKey
pRevDescrip dirVec
Sets the profile to revolve on a revolve descriptor. The sketch key is copied when this call is made.
Input
pRevDescrip pSketchKey
Chamfer Descriptors
AmiStatus amiGetChamferData
( AmiChamferDescrip* pChamfDescrip, AmiChamferType& chamfType, AmiValue& angle, AmiValue& distance1, AmiValue& distance2 ) Gets the data from a chamfer descriptor.
Input
05/12/2001 Page 130
pChamfDescrip
Output
Pointer to a chamfer descriptor. The chamfer type. Angle, if the chamfer is a right or left angle chamfer (degrees). Distance from first edge. Distance from second edge if the chamfer is a uniform or differential chamfer.
AmiStatus amiSetChamferAngle
( AmiChamferDescrip* pChamfDescrip, const AmiValue& angle ) Sets the angle value on a chamfer descriptor.
Input
pChamfDescrip angle
AmiStatus amiSetChamferAngleFace
( AmiChamferDescrip* pChamfDescrip, AmiPlaneKey* pFaceKey ) Sets the face to which to apply the chamfer angle. The input key is copied when this call is made.
Input
pChamfDescrip pFaceKey
AmiStatus amiSetChamferDist1
( AmiChamferDescrip* pChamfDescrip, const AmiValue& distance1 ) Sets the first distance value on a chamfer descriptor.
Input
pChamfDescrip distance1
AmiStatus amiSetChamferDist1Face
Sets the face to which to apply the first distance in a two distance chamfer. The input key is copied when this call is made.
Input
( AmiChamferDescrip* pChamfDescrip, const AmiValue& distance2 ) Sets the second distance value on a chamfer descriptor.
Input
pChamfDescrip distance2
AmiStatus amiSetChamferEdges
( AmiChamferDescrip* pChamfDescrip, int nEdges, const AmiCurveKey** pEdges ) Sets the edges on a chamfer descriptor. The array and the keys contained within are copied when this call is made.
Input
Pointer to a chamfer descriptor to set. Number of edges to set. Array of keys to the edges.
AmiStatus amiSetChamferType
( AmiChamferDescrip* pChamfDescrip, AmiChamferType, chamfType ) Sets the chamfer type on a chamfer descriptor.
Input
pChamfDescrip chamfType
Fillet Descriptors
AmiStatus amiGetCubicFilletData
( AmiCubicFilletDescrip* pFilletDescrip, int& nRadii, AmiValue*& pRadii, double*& pParam ) Gets the data from a cubic variation fillet descriptor. It is the callers responsibility to delete the returned array.
Input
pFilletDescrip
Output
Pointer to a fillet descriptor. Number of radius values (one for each vertex). Array of radius values. Radius placement parameter values.
AmiStatus amiGetFixedFilletData
( AmiFixedFilletDescrip* pFilletDescrip, AmiValue& chordLength ) Gets the data from a fixed width fillet descriptor.
Input
pFilletDescrip
Output
chordLength
AmiStatus amiGetIndFilletData
( AmiIndFilletDescrip* pFilletDescrip, int& nRadii, AmiValue*& pRadii ) Gets the data from an individual radius fillet descriptor. It is the callers responsibility to delete the array.
Input
pFilletDescrip
Output
Pointer to a fillet descriptor. Number of radius values (one for each edge).
05/12/2001 Page 132
nRadii
pRadii
AmiStatus amiGetLinearFilletData
( AmiLinearFilletDescrip* pFilletDescrip, int& nRadii, AmiValue*& pRadii ) Gets the data from a linear variation fillet descriptor. It is the callers responsibility to delete the array of radius values.
Input
pFilletDescrip
Output
Pointer to a fillet descriptor. Number of radius values (one for each vertex). Array of radius values (one for each vertex).
nRadii pRadii
AmiStatus amiGetUniFilletData
( AmiUniFilletDescrip* pFilletDescrip, AmiValue& radius ) Gets the data from a uniform fillet descriptor.
Input
pFilletDescrip
Output
radius
AmiStatus amiSetCubicFilletRadii
( AmiCubicFilletDescrip* pFilletDescrip, int nRadii, const AmiValue* pRadii, const double* pParam ) Sets the radius values on a cubic fillet descriptor. The arrays are copied when this call is made.
Input
Pointer to a fillet descriptor to set. Number of radii. New radius value array. Parameter array for radius placement.
AmiStatus amiSetFilletEdges
( AmiFilletDescrip* pFilletDescrip, int nEdges, const AmiCurveKey** pEdges ) Sets the edges on a fillet descriptor. The array and the keys contained within are copied when this call is made.
Input
Pointer to a fillet descriptor to set. Number of edges to set. Array of keys to the edges.
AmiStatus amiSetFixedFilletChordLength
( AmiFixedFilletDescrip* pFilletDescrip, const AmiValue& chordLength ) Sets the chord length on a fixed width fillet descriptor.
Input
pFilletDescrip
chordLength
AmiStatus amiSetIndFilletRadii
( AmiIndFilletDescrip* pFilletDescrip, int nRadii, const AmiValue* pRadii ) Sets the radius values on an individual radius fillet descriptor. The radius array is copied when this call is made.
Input
Pointer to a fillet descriptor to set. Number of radii. New radius value array.
AmiStatus amiSetLinearFilletRadii
( AmiLinearFilletDescrip* pFilletDescrip, int nRadii, const AmiValue* pRadii ) Sets the radius values on a linear fillet descriptor. The array is copied when this call is made.
Input
Pointer to a fillet descriptor to set. Number of radii. New radius value array.
AmiStatus amiSetUniFilletRadius
( AmiUniFilletDescrip pFilletDescrip, const AmiValue& radius ) Sets the radius on a uniform fillet descriptor.
Input
pFilletDescrip radius
Sweep Descriptors
AmiStatus amiGetSweepData
( AmiSweepDescrip* pSweepDescrip, AmiSweepMethod& method, AmiValue& draftAngle ) Gets the data from a sweep descriptor.
Input
method draftAngle
pSweepDescrip draftAngle
pSweepDescrip method
pSweepDescrip pSketchKey
Sets the profile to sweep on a sweep descriptor. The input key is copied when this call is made.
Input
pSweepDescrip pSketchKey
( AmiArrayDescrip* pArrDescrip, int& nFeatKeys, AmiFeatKey**& pFeatKeys ) Gets the data from an array descriptor. It is the callers responsibility to release all the keys in the array and delete the array.
Input
nFeatKeys pFeatKeys
Number of feature keys being returned. Array of feature keys to the features that have been arrayed.
AmiStatus amiGetPolarArrayData
( AmiPolarArrayDescrip* pArrDescrip, AcGeVector3d& revAxis, AmiPolarAngleType& angleType, AmiValue& angle, AmiValue& nInstances, Adesk::Boolean& fRotateAsCopied, AmiPointKey*& pPointKey ) Gets the data from a polar array descriptor. It is the callers responsibility to release the returned point key.
Input
pArrDescrip
Output
Pointer to a polar array descriptor. Axis of revolution (with direction). Polar angle type. kfillAngle: Where the number of instances are placed within the given angle.
05/12/2001 Page 135
revAxis angleType
kfullAngle: Where the number of instances are run 360 degrees. kincrAngle: Where the angle specified is the angle between each instance. angle The array angle (degrees). nInstances Number of instances. fRotateAsCopied Rotate feature as copied flag. pPointKey Rotate reference point.
AmiStatus amiGetRecArrayData
( AmiRecArrayDescrip* pArrDescrip, AcGeVector3d& xVec, AcGeVector3d& yVec, AmiValue& nRows, AmiValue& rowSpacing, AmiValue& nCols, AmiValue& colSpacing ) Gets the data from a rectangular array descriptor.
Input
Vector describing X direction of array. Vector describing Y direction of array. Number of rows. The row spacing value. Number of columns. The column spacing value.
Sets the feature to be arrayed on an array descriptor. The input key is copied when this call is made.
Input
pArrDescrip Pointer to array descriptor to set. pFeatKey Pointer to feature key to be used as base.
AmiStatus amiSetPolarArrayAngle ( AmiPolarArrayDescrip* pArrDescrip, const AmiValue& angle )
pArrDescrip angle
pArrDescrip nInstances
Sets the rotate as copied flag and, optionally, the rotate reference point on a polar array descriptor. The input key is copied when this call is made.
Input
Pointer to array descriptor to set. Rotate feature as copied flag. Rotate as copied reference work point. This point must be specified if fRotateAsCopied is false.
pArrDescrip Pointer to array descriptor to set. angleType Polar angle type. kFillAngle Where the number of instances are placed within the given angle. kFullAngle Where the number of instances are run 360 degrees. kIncrAngle Where the angle specified is the angle between each instance.
AmiStatus amiSetRecArrayColData ( AmiRecArrayDescrip* pArrDescrip, const AmiValue& nCols, const AmiValue& colSpacing )
AmiStatus amiSetRecArrayRowData ( AmiRecArrayDescrip* pArrDescrip, const AmiValue& nRows, const AmiValue& rowSpacing)
pArrDescrip xVec
pArrDescrip yVec
( AmiSurfCutDescrip* pSurfCutDescrip, AmiSurfKey*& pSurfKey, AcGeVector3d& dirVec ) Gets the data from a surf cut descriptor. It is the callers responsibility to release the key returned.
Input
pSurfCutDescrip
Output
Pointer to a surf cut descriptor. Key to surface used for surf cut. Surf cut direction vector.
pSurfKey dirVec
pSurfCutDescrip dirVec
Sets the surface key on a surf cut descriptor. The input key is copied when this call is made.
Input
pSurfCutDescrip pSurfKey
Pointer to surf cut descriptor. Pointer to a surface key. This key must be an AutoSurf surface.
Shell Descriptors
AmiStatus amiGetShellData
( AmiShellDescrip* pShellDescrip, int& nOverrides, AmiSurfKey**& pOverrides, AmiValue*& pThicknesses, int& nExcludes, AmiSurfkey**& pExcludes ) Gets the data from a shell descriptor. It is the callers responsibility to release all keys returned and delete all arrays.
Input
pShellDescrip
Output
Pointer to a shell descriptor. Number of thickness overrides. Keys to faces to thickness overrides. Thickness values for each face.
05/12/2001 Page 138
nExcludes pExcludes
Sets the excluded faces on a shell descriptor. The array and keys contained within are copied when this call is made.
Input
Pointer to shell descriptor to set. Number of excluded faces. Array of keys to excluded faces.
AmiStatus amiSetShellOverrides ( AmiShellDescrip* pShellDescrip, int nOverrides, AmiSurfKey** pOverrides, AmiValue* pThicknesses )
Sets the thickness overrides on a shell descriptor. The array and keys contained within are copied when this call is made.
Input
Pointer to shell descriptor to set. Number of overrides. Array of keys to faces to override. The thickness for each override.
( AmiParametricBoolDescrip* pParmDescrip, AmiCompKey*& pCompKey ) Gets the data from a parametric boolean descriptor. It is the caller's responsibility to release the returned key.
Input
pParmDescrip
Output
pCompKey
Sets the component key on a parametric boolean descriptor. The input key is copied when this call is made.
Input
pParmDescrip pCompKey
Creates a work entity on the active part using the constrained geometry descriptor. It is the caller's responsibility to release the returned key.
Input
pGeomDescrip Constrained geometry descriptor used to create the work entity. FGeomKey Set true if a key to the new work entity is to be returned. pGeomKey Output geometry key if fGeomKey is true.
AmiStatus amiGetConstrGeomData
( AmiConstrGeomDescrip* pGeomDescrip, AmiGeomKey*& pGeomKey ) Gets the data from a constrained geometry descriptor. It is the caller's responsibility to release the returned key.
Input
pGeomDescrip
Output
Pointer to a constrained geometry descriptor. Key referring to the constrained geometry. If the descriptor was created with fRetainKey equal to kFalse, this will always be NULL.
pGeomKey
AmiStatus amiGetWorkPlaneData
( AmiWorkPlaneDescrip* pWPDescrip, AmiVectorKey*& pVecKey, AmiWorkPlaneAxisType& rAxisType, AmiCoordinateSystem& rCoordSys ) Gets the data from a work plane descriptor. It is the caller's responsibility to release the returned key. The work plane data comes back in the form of locators. If there is a sketch plane on the work plane, the output parameters to this function are used to describe the sketch plane orientation. The vector key is the vector used to orient the sketch plane while the axis type determines which axis in the sketch plane's coordinate system the vector represents. The rCoordSys parameter describes whether the sketch plane's coordinate system is left or right handed. The rCoordSys value cannot be set by users. It only gets flipped if the part that the work plane is created on gets mirrored.
Input
Axis used to orient the sketch plane. If no sketch plane was created, this key will be NULL. UCS axis that the vector is used for. UCS coordinate system.
Loft Descriptors
AmiStatus amiGetLoftData
(AmiLoftDescrip* pLoftDescrip, AmiLoftType& loftType, Adesk::Boolean& fMinimizeTwist, AmiValue& rStartWeight, AmiValue& rEndWeight, Adesk::Boolean& fTangentToStart, AmiValue& rStartAngle, Adesk::Boolean& fTangentToEnd, AmiValue& rEndAngle, int& nXSections, AmiXSection*& pXSections)
Gets the data from a loft descriptor. It is the caller's responsibility to delete the array of cross sections.
Input
pLoftDescrip
Output
Pointer to a loft descriptor. Loft type. Twist minimization flag Loft alignment type. Weight at starting cross section. Weight at ending cross section. If true, loft start angle is tangent to face. Start angle if fTangentToStart is false. If true, loft end angle is tangent to face. End angle if fTangentToEnd is false. Number of cross sections. Array of cross sections. Cross section can be a closed profile (sketch key), a planar face (plane key), or a work point (point key). Point keys can only be used on the starting and/or ending cross section.
loftType fMinimizeTwist alignment rStartWeight rEndWeight fTangentToStart rStartAngle fTangentToEnd rEndAngle nXSections pXSections
AmiStatus amiSetLoftAngles ( AmiLoftDescrip* pLoftDescrip, Adesk::Boolean fTangentToStart, const AmiValue& rStartAngle, Adesk::Boolean fTangentToEnd, const AmiValue& rEndAngle )
Sets the angles at the starting and ending cross sections of a loft.
Input
Pointer to a loft descriptor. If true, loft start angle is tangent to face. Start angle if fTangentToStart is false. If true, loft end angle is tangent to face. End angle if fTangentToEnd is false.
pLoftDescrip fMinimize
pLoftDescrip loftType
AmiStatus amiSetLoftWeights (AmiLoftDescrip* pLoftDescrip, const AmiValue& rStartWeight, const AmiValue& rEndWeight)
Sets the weights at the starting and ending cross sections of a loft.
Input
Pointer to a loft descriptor. Weight at starting cross section. Weight at ending cross section.
Sets the cross sections on a loft. The cross sections array is copied when this call is made.
Input
Pointer to a loft descriptor. Number of cross sections. Array of cross sections. Cross section can be a closed profile (sketch key), a planar face (plane key), or a work point (point key). Point keys can only be used on the starting and/or ending cross section.
( AmiDraftDescrip* pDraftDescrip, AmiPlaneKey* & pDraftPlane, Adesk::Boolean& fFlipNormal, AmiValue& rAngle, Adesk::Boolean& fIncludeTangents ) Gets the data from a draft descriptor. It is the caller's responsibility to release the returned key.
Input
pDraftDescrip
Output
Pointer to a draft descriptor. Key to plane or planar face from which to measure the draft angle.
pDraftPlane fFlipNormal
If true, the angle is measure opposite of the draft plane normal. Draft angle.
If true, include tangent faces/edges when computing draft.
rAngle fIncludeTangents
AmiStatus amiGetEdgeDraftData
( AmiEdgeDraftDescrip* pDraftDescrip, int& nFaces, AmiEdgeDraftFace*& pFaces ) Gets the data from an edge draft descriptor. It is the caller's responsibility to delete the array of faces.
Input
pDraftDescrip
Output
Pointer to an edge draft descriptor. Number of faces that were drafted. Array of draft face objects.
nFaces pFaces
AmiStatus amiGetPlaneDraftData
(AmiPlaneDraftDescrip* pDraftDescrip, int& nFaces, AmiSurfKey**& pFaces) Gets the data from a plane draft descriptor. It is the caller's responsibility to delete the array of keys.
05/12/2001 Page 142
Input
pDraftDescrip
Output
Pointer to a plane draft descriptor. Number of faces that were drafted. Array of keys to drafted faces.
nFaces pFaces
AmiStatus amiGetShadowDraftData
(AmiPlaneDraftDescrip* pDraftDescrip, int& nFaces, AmiSurfKey**& pFaces) Gets the data from a shadow draft descriptor. It is the caller's responsibility to delete the array of keys.
Input
pShadowDescrip
Output
Pointer to a shadow draft descriptor. Number of faces that were drafted. Array of keys to drafted faces.
nFaces pFaces
Sets the plane or planar face to measure the angle from on a draft descriptor.
Input
pDraftDescrip Pointer to draft descriptor. pDraftPlane Key to plane or planar face from which to measure the draft angle.
AmiStatus amiSetDraftTangents (AmiDraftDescrip *pDraftDescrip, Adesk::Boolean fIncludeTangents)
pDraftDescrip fIncludeTangents
Pointer to draft descriptor. If true, include tangent faces/edges when computing draft.
Sets the plane or planar face from which to measure the angle on a draft descriptor. The input key is copied when this call is made.
Input
Pointer to draft descriptor. Key to plane or planar face from which to measure the draft angle. If true, the angle is measured opposite of the draft plane normal.
Sets the face info on an edge draft descriptor. The array and keys contained within are copied when this call is made.
Input
pDraftDescrip
nFaces pFaces
Sets the faces to draft on a plane draft descriptor. The array and keys contained within are copied when this call is made.
Input
Pointer to a plane draft descriptor. Number of faces to draft. Array of face keys.
Sets the faces to draft on a shadow draft descriptor. The array and keys contained within are copied when this call is made.
Input
Pointer to a shadow draft descriptor. Number of faces to draft. Array of face keys.
Split Descriptors
AmiStatus amiGetFaceSplitData ( AmiFaceSplitDescrip* pSpltDescrip, Adesk::Boolean& fAllFaces, int& size, AmiSurfKey**& ppFaces )
Gets the data from a face split feature descriptor. It is the caller's responsibility to release all keys in the output array.
Input
pSpltDescrip
Output
Pointer to split descriptor. True if all faces are candidates for split. Size of array of keys to faces (0 if fAllFaces is kTrue). Array of pointers to keys to faces (NULL if fAllFaces is kTrue).
pSpltDescrip
Output
Pointer to split descriptor. If false, the normal of the cutting plane was used to determine which half of the resulting split was converted into a new part. If true, the reverse of the normal was used.
fFlipNormal
AmiStatus amiSetFaceSplitFaces (AmiFaceSplitDescrip* pSpltDescrip, Adesk::Boolean fAllFaces = Adesk::kTrue, int size = 0, AmiSurfKey** ppFaces = NULL)
Sets the list of faces to split on a face split descriptor. The array and keys contained within are copied when this call is made.
Input
Pointer to split descriptor. If true, all faces will be candidates for the split and no more data will be required (or used). Size of array of keys to faces (must be nonzero if fAllFaces is kFalse). Array of pointers to keys to faces (must be non NULL if fAllFaces is kFalse).
pSpltDescrip fFlipNormal
Pointer to split descriptor. If false, the normal of the cutting plane is used to determine which half of the resulting split will be converted into a new part. If true, the reverse of the normal is used.
Sets the name of the part resulting from the split on a part split descriptor.
Input
pSpltDescrip pPartName
Sets the part name for a split combiner on a feature descriptor. This function only applies if the combiner type is set to "kSplitPart".
Input
pFeatDescrip pPartName
Sketch Descriptors
AmiStatus amiCreateSketchDescrip
( Ami::SketchType sketchType, AmiSketchDescrip*& pSketchDescrip, const char* appName = Designer ) Creates an empty sketch descriptor.
Input
sketchType
appName
Output
pSketchDescrip
AmiStatus amiCreateSketch
pDescrip
Output
pSketchKey
AmiStatus amiGetData
(AmiSketchDescrip* pSketchDescrip, Ami::SketchAttribute keyword, <Return Type> value ) Extracts information from the given sketch descriptor. This function is overloaded for all the various data types for attributes
Input
pSketchDescrip keyword
Output
Pointer to the sketch descriptor. Keyword for attribute. The value for the specified attribute.
value
AmiStatus amiSetData
(AmiSketchDescrip* pSketchDescrip, Ami::SketchAttribute keyword, <Return Type> value ) Sets information on the given sketch descriptor. This function is overloaded for all the various data types for attributes.
Input
Pointer to the sketch descriptor. Keyword for attribute. The value of the specified attribute.
Datatype
AmiObjectKey* AmiSketchPlaneKey*
Applies to
All ClosedProfile Path CutLine SplitLine Polyline Helical Spiral PolylinePath ClosedProfile Path CutLine SplitLine
Description
Scope to part where sketch is created. Key to sketch plane to create the sketch on.
kInferredConstraints
Adesk::Boolean
Attribute keyword
kAttSelectionList
Datatype
AmiSelection*
Applies to
ClosedProfile Path CutLine SplitLine Polyline PolylinePath AxisProfile PolylinePath EdgePath AxisProfile EdgePath
Description
List of geometry to use to create the sketch.
kAttStartPoint
AcGePoint3d
Start point of work axis sketch End point of work axis sketch List of tangent continuous edges used to create edge path. Start vertex for edge path. Spline curve to create path from. If false, the start of the spline is the start of the path. If true, the path is reversed. Number of revolutions on a spiral or helical path. For a spiral path, the change in radius per revolution. For a helical, the change in height. The angle from the x-axis of the sketch plane where the helix/spiral should start. The major diameter of the first revolution. The minor diameter of the first revolution. The work axis to revolve around. A cylindrical face from which the work axis to revolve around will be created. If true, revolve clockwise. If false, counter clockwise. Which values to use to create the helix. The height of the helix. The angle by which the helix will taper along its height. If false, the helix rises along the sketch plane normal. If true, it moves along the reverse of the
kAttEndPoint kAttEdgeList
kAttRevolutions kAttPitch
AmiValue AmiValue
kAttStartAngle
AmiValue
SpiralPath
kAttFlipFlag
Adesk::Boolean
HelicalPath
Attribute keyword
Datatype
Applies to
Description
normal.
( AmiSketchPlaneKey* pSkPlnKey, AmiSketchPlaneDescrip*& pDescrip, Adesk::Boolean fReturnInformers ) Gets a descriptor from a sketch plane key.
Input
pSkPlnKey fReturnInformers
Output
Pointer to a sketch plane key. If true, the full description is returned, including all locators. Otherwise, locators will not be available. Pointer to a new descriptor object.
pDescrip
pDescrip fKey
Output
Pointer to a sketch plane descriptor. If true, creates and returns a sketch plane key. Pointer to the returned sketch plane key.
pSkPlnKey
appName
Output
Name of the application that should create the key. Pointer to plane key.
pPlaneKey
Array Descriptors
AmiStatus amiArrayHasIndependentInstances (AmiArrayDescrip *pArrDescrip,Adesk::Boolean& hasIndep)
Queries a feature array descriptor to see if the array feature has any independent instances.
Input
pArrDescrip
Output
hasIndep
col
Output
For rectangular arrays, this is the zero based row index of the instance to be queried. For polar arrays, this is the linear zero based index of the instance to be queried. For rectangular arrays, this is the zero based column index of the instance to be queried. For polar arrays, this parameter is ignored. TRUE if the instance is independent
isIndep
Bend Descriptors
AmiStatus amiGetBendData ( AmiBendDescrip *pBendDescrip, AmiBendType bendType, AmiValue& angle, AmiValue& radius, AmiValue& arcLen, AcGeVector3d& bendSide, AcGeVector3d& bendDir )
pBendDescrip
Output
The bend type specifiez which combination of any two of the angle, radius or arc length values are used to make the bend. The bend angle value. The bend radius value. The bend arc length value. The bend side vector. The bend direction vector.
pBendDescrip angle
pBendDescrip arcLen
AmiStatus amiSetBendDirection
( AmiBendDescrip* pBendDescrip, const AcGeVector3d& bendDir )
pBendDescrip bendDir
Sets the profile to extrude on an bend descriptor. The sketch key is copied when this call is made.
Input
pBendDescrip pSketchKey
pBendDescrip radius
pBendDescrip bendSide
pBendDescrip bendType
Pointer to a bend descriptor. The bend type specifiez which combination of any two of the angle, radius or arc length values are used to make the bend.
Rib Descriptors
AmiStatus amiGetRibData ( AmiRibDescrip* pRibDescrip, AmiThicknessType& thickType, AmiValue& thickness1, AmiValue& thickness2, AcGeVector3d& ribDir )
pRibDescrip
Output
Pointer to a rib descriptor. Thickness type. Rib thickness. 2nd thickness if type is two directions. Rib direction vector.
pRibDescrip ribDir
Sets the profile to extrude on an rib descriptor. The sketch key is copied when this call is made.
Input
pRibDescrip pSketchKey
AmiStatus amiSetRibThickness ( AmiRibDescrip* pRibDescrip, AmiThicknessType thickType, const AmiValue& thickness1, const AmiValue& thickness2 )
pRibDescrip
Output
Pointer to rib descriptor to set. Thickness type. Rib thickness. 2nd thickness if type is two directions.
Pattern Descriptors
AmiStatus amiGetPatternData ( AmiPatternDescrip* pPatternDesc, AmiArray<AmiFeatKey>& featKeys, Adesk::UInt32& nSuppressed, AmiPatternInstance*& pSuppressedInsts )
Input
PPatternDesc
Output
Pointer to a pattern descriptor. Array containing the list of features that were patterned. Number of suppressed pattern instances. Array of indices representing suppressed pattern instances. It is the caller's responsibility to delete this array.
PPatternDesc FeatKeys
Pointer to a pattern descriptor. Number of instances suppressed. Array of indices representing suppressed pattern instances.
pPatternDesc
Output
Number of revolutions. How the offset height value is used. Offset height value. Offset direction.
05/12/2001 Page 152
pPatternDesc nRevolutions
pPatternDesc offsetDir
pPatternDesc offsetHeight
pPatternDesc offsetSpacingType
pPatternDesc
Output
Number of instances. angleSpacingType How the angle value is used. angle Angle value. fClockwiseRotDir Rotation direction. Clockwise when true. fMaintainOrientation If true, then orientation is maintained. pOrientationWorkPoint If orientation is maintained, the workpoint used. NULL otherwise.
nInstances
AmiStatus amiSetPolarPatternAngle ( AmiPolarPatternDescrip* pPatternDesc, const AmiValue& angle )
pPatternDesc angle
pPatternDesc angleSpacing
pPatternDesc nInst
Calling this function sets the maintain orietation property on a polar pattern descriptor. The associated workpoint must be passed in.
Input
Pointer to a polar pattern descriptor. pOrientationWorkPoint Pointed to the workpoint for orientation.
pPatternDesc
AmiStatus amiSetPolarPatternRotationDirection
( AmiPolarPatternDescrip* pPatternDesc, Adesk::Boolean fClockwise )
Pointer to a polar pattern descriptor. fClockwise If true, the rot dir is clockwise; if false, counterclockwise.
pPatternDesc
pPatternDesc
Output
Pointer to a pattern descriptor. Sketch plane used for the pattern. Number of column instances. How the column spacing value was used. Column spacing value. Direction of the pattern column. Number of row instances. How the row spacing value was used. Row spacing value. Direction of the row column. If true, then the columns are Aligned To Edge, and the edge is returned through an aligned locator. If fAlignedToEdge is false, this is the angle used for column alignment; otherwise, this parameter is meaningless.
pSketchPlane nColInstances colSpacingType colSpacing colDirection nRowInstances rowSpacingType rowSpacing rowDirection fAlignedToEdge alignmentAngle
pPatternDesc alignmentAngle
AmiStatus amiSetRectangularPatternColumnData ( AmiRectangularPatternDescrip* pPatternDesc, const AmiValue& nColumnInstances, AmiPatternSpacing columnSpacingType, const AmiValue& columnSpacing )
Pointer to a rectangular pattern descriptor. Number of column instances. Column spacing type. Column spacing.
Sets the column direction on a rectangular pattern descriptor. NOTE: Column angle or edge alignment is set separately.
Input
pPatternDesc columnDirection
AmiStatus amiSetRectangularPatternRowData ( AmiRectangularPatternDescrip* pPatternDesc, const AmiValue& nRowInstances, AmiPatternSpacing rowSpacingType, const AmiValue& rowSpacing)
Pointer to a rect. pattern descriptor. Number of row instances. Row spacing type. Row spacing.
pPatternDesc rowDirection
pPatternDesc pSketchPlane
Locators
AmiStatus amiAddAtomLocator ( AmiLocator* pLoc, AmiAtomLocator* pAtomLoc )
Adds an atomic locator object to a locator's list of atomic locators. The atomic locator is copied when this call is made.
Input
pLoc Pointer to locator object where atomic locator will be added. pAtomLoc Pointer to atomic locator to add.
AmiStatus amiCreateAtomLocator ( AmiAtomLocatorType locType, AmiAtomLocator*& pAtomLoc, char* appName=Designer )
Creates a new atomic locator object of the given type. It is the caller's responsibility to delete the atomic locator.
Input
locType appName
Output
Type of atomic locator to create. Name of app that should create the locator.
Creates a new empty locator object. It is the caller's responsibility to delete the locator.
Input
appName
Output
Name of app that should create the locator. Pointer to new locator object.
pLoc
AmiStatus amiGetAbsoluteLocData
( AmiAbsoluteLoc* pLoc, AmiAbsoluteLocType& rType ) Gets the data from an "absolute" locator.
Input
pLoc
Output
rType
AmiStatus amiGetAngledLocData
( AmiAngledLoc* pLoc, AmiValue& rAngle, Adesk::Boolean& fFlip ) Gets the data from an "angled" locator.
Input
pLoc
Output
Pointer to an angled locator. Angle off of the plane. True if angled away from normal.
rAngle fFlip
AmiStatus amiGetAtomLocators
( AmiLocator* pLoc, int& nLocators, AmiAtomLocator**& pLocators ) Gets all of the atomic locators from a feature locator. It is the callers responsibility to delete all the locators in the array and delete the array.
Input
pLoc
Output
Pointer to a locator object. Number of atomic locators. Array of pointers to atomic locator objects.
nLocators pLocators
AmiStatus amiGetAtomLocData
( AmiAtomLocator* pLoc, AmiObjectKey*& pObjKey ) Gets the object key from a locator. It is the callers responsibility to release the key.
Input
pLoc
Output
pObjKey
AmiStatus amiGetAtomLocType
pLoc
Output
locType
AmiStatus amiGetCoordSysLocData
( AmiCoordSysLoc* pLoc, AcGeVector3d& rAlignVec, AmiNormalOrientnType& normDir ) Gets the data from a "coordinate system" locator.
Input
pLoc
Output
Pointer to a coordinate system locator. Alignment vector determines to orientation. The vector is adjusted to run either parallel or perpendicular with the alignment axis and represents the positive X direction of the resulting coordinate system. Normal orientation.
rAlignVec
normDir
AmiStatus amiGetDistFromLocData
( AmiDistFromLoc* pLoc, AmiValue& dist, AcGeVector3d& dirVec ) Gets the data from a "distance from" locator.
Input
pLoc
Output
dist dirVec
AmiStatus amiGetLocator
Gets the locator object from a feature descriptor. It is the callers responsibility to delete the locator being returned.
Input
pFeatDescrip
Output
pLoc
AmiStatus amiGetOffsetLocData
( AmiOffsetLoc* pLoc, AmiValue& rOffset, Adesk::Boolean& positiveNormal ) Gets the data from an offset locator.
Input
pLoc
Output
Pointer to an offset locator. Offset from the plane. Normal is flipped if false.
rOffset positiveNormal
AmiStatus amiGetOnPlaneLocData
( AmiOnPlaneLoc* pLoc, AcGePoint3d& pos ) Gets the data from an on-plane locator.
Input
pLoc
Output
pos
pLoc
Output
pt
pLoc type
pLoc
rAngle fFlip
Sets the object key on an atomic locator. The key is copied when this call is made.
Input
pLoc pObjKey
pLoc Pointer to a coordinate system locator. rAlignVec Alignment vector determines to orientation. The vector is adjusted to run either parallel or perpendicular with the alignment axis and represents the positive X direction of the resulting coordinate system. If no alignment axis was specified, this vector is used as the X axis of the new coordinate system. normDir Normal orientation.
AmiStatus amiSetDistFromLocData ( AmiDistFromLoc* pLoc, const AmiValue& dist, const AcGeVector3d& dirVec )
Pointer to a distance from locator. Distance value. Direction vector from geometry.
Sets the locator object on a feature descriptor. The locator is copied when this call is made.
Input
pFeatDescrip pLoc
pLoc pos
pLoc pos
Terminators
AmiStatus amiCreateTerminator ( AmiTerminatorType termType, AmiTerminator*& pTerm, char* appName=Designer )
Creates a new empty terminator object. It is the caller's responsibility to delete the terminator.
Input
termType appName
Output
Type of terminator to create. Name of app that should create the terminator. Pointer to new terminator object.
pTerm
AmiStatus amiGetBlindTermData
( AmiBlindTerm* pTerm, AmiValue& value ) Get the data from a blind terminator.
Input
pTerm
Output
value
AmiStatus amiGetFromToTermData
( AmiFromToTerm* pTerm, int& loopIndex1, AmiSurfKey*& pSurfKey1, int& loopIndex2, AmiSurfKey*& pSurfKey2 ) Gets the data from a "from to" terminator object. It is the callers responsibility to release all the keys returned.
Input
Pointer to a "from to" terminator object. If there are multiple intersections with the face, the index of intersection to start. The face at which the feature starts. If there are multiple intersections with the face, the index of intersection to stop.
pSurfKey2
AmiStatus amiGetInsideTermData
( AmiInsideTerm* pTerm, AmiValue& value ) Gets the data from an inside terminator.
Input
pTerm
Output
value
AmiStatus amiGetMidPlaneTermData
( AmiMidPlaneTerm* pTerm, AmiValue& value ) Gets the data from a midplane terminator object.
Input
pTerm
Output
value
AmiStatus amiGetOutsideTermData
( AmiOutsideTerm* pTerm, AmiValue& value ) Gets the data from an outside terminator.
Input
pTerm
Output
value
AmiStatus amiGetTerminator
( AmiFeatDescrip* pFeatDescrip, AmiTerminator*& pTerm ) Gets the terminator from a feature descriptor. It is the callers responsibility to delete the terminator returned.
Input
pFeatDescrip
Output
pTerm
AmiStatus amiGetTermType
pTerm
Output
tType
AmiStatus amiGetToFaceTermData
( AmiToFaceTerm* pTerm, int& loopIndex, AmiSurfKey*& pSurfKey ) Gets the data from a "to face" terminator object. It is the callers responsibility to release the key returned.
Input
pTerm
Output
Pointer to a "to face" terminator object. If there are multiple intersections with the face, the index of intersection to use. The face at which the feature terminates.
loopIndex pSurfKey
AmiStatus amiGetToPlaneTermData
( AmiToPlaneTerm* pTerm, AmiPlaneKey*& pPlaneKey ) Gets the data from a "to plane" terminator object. It is the callers responsibility to release the key returned.
Input
pTerm
Output
pPlaneKey
pTerm value
AmiStatus amiSetFromToTermData ( AmiFromToTerm* pTerm, int loopIndex1, AmiSurfKey* pSurfKey1, int loopIndex2, AmiSurfKey*
pSurfKey2 ) Sets the data on a "from to" terminator object. The input keys are copied when this call is made.
Input
Pointer to a "from to" terminator object. If there are multiple intersections with the face, the index of intersection to start. Key to the face at which the feature starts. If there are multiple intersections with the face, the index of intersection to stop. Key to the face at which the feature stops.
pTerm value
pTerm value
pTerm value
Sets the terminator object on a feature descriptor. The terminator is copied when the call is made.
Input
pFeatDescrip pTerm
Sets the data on a "to face" terminator object. The input key is copied when this call is made.
Input
Pointer to a "to face" terminator object. If there are multiple intersections with the face, the index of intersection to use. Key to the terminating face.
Sets the data on a "to plane" terminator object. The input key is copied when this call is made.
Input
pTerm pPlaneKey
Table-Driven Versions
These functions give access to the table-driven functionality in Mechanical Desktop Release 3.0, both for parts (design variables and feature suppression) and for global design variables. It relies on file descriptors, which describe the file used to version the design. (it is defined in the header file mifile.h). See the file descriptor section for details on accessing the information in this descriptor.
AmiStatus amiGetCurrentVersion ( char*& ver, AmiObjectKey* pVersionedObj =NULL )
Get the current version set on the object referenced by pVersionedObj. If pVersionedObj is null, the global design variable spreadsheet version is queried. It is the callers responsibility to delete the version string.
Input
pVersionedObj
Output
Key referencing the table driven object to be queried. The string name of the current version.
ver
Get the descriptor for the spreadsheet controlling the object referenced by pVersionedObj. If pVersionedObj is null, the global design variable spreadsheet is queried. It is the callers responsibility to free the descriptor.
Input
pVersionedObj
Output
Key referencing the table driven object to be queried. File descriptor describing the linked file.
pFileDescrip
Remove the table driven spreadsheet controlling the object referenced by pVersionedObj. If pVersionedObj is null, the global parameter spreadsheet is unlinked.
Input
pVersionedObj
Set the current version of the object referenced by pVersionedObj. If pVersionedObj is null, the global design variable spreadsheet version is set. This version name is case-sensitive.
Input
pVersionedObj ver
Key referencing the table driven object to be queried. The string name of the current version.
Create and populate the table driven spreadsheet controlling the object referenced by the attribute kAttVersionedObj. If this attribute is null or NAV, the global parameter information is used. The file will be populated using the information in the descriptor including the structure of the spreadsheet and the file. If the file name already exists the link will fail.
Input
pFileDesc
AmiStatus amiBuildFile
( AmiFileDescrip* pFileDesc)
Create and populate the table driven spreadsheet controlling the object by the attribute kAttVersionedObj. If this attribute is null or NAV, the file is built using global parameter
05/12/2001 Page 165
information. The file will be populated using the information in the descriptor including the structure of the spreadsheet and the file. If the file name already exists the link will fail.
Input
pFileDesc
Event Handling
The event handling functions allow applications to register callback functions for specific Mechanical Desktop events. This function will be called every time the specified event occurs in the Desktop, until the callback is unregistered. The event registrations persist across file opens, but during a single session only. They must be re-registered each time the Desktop is loaded. Each event has a prescribed signature, which the registered callback must fulfill. The signature is typically a key(s) to the affected objects and a context flag. The context flag is used to provide an indication of why the event occurred, e.g. during a copy, during creation of a new file. The Ami::eNullContext indicates that the event occurred during normal modelling operations. The event reaction is described using an AmiReactDescrip. The make function on this descriptor ensures the appropriately typed function pointer is given for the event keyword (amiEventType) specified. This descriptor is passed to amiRegisterEventReaction, and from that point forward (until the end of session, or the reaction is unregistered), the specified function is called each time the specified event occurs. Argument control for the reaction can be specified using amiSetData, passing in the appropriate keyword and value. Before registering events, an application must get an application id by calling amiRegisterApp. Given a string (uniquely) identifying the application, this function will return an identifier to be used when registering or unregistering callbacks.
AmiStatus amiReactDescrip::make ( <CallBack Signature Type> fcn, AmiEventType type, AmiReactDescrip*& pRD )
Makes a reaction descriptor to pass into amiRegisterEventReaction. There is one version for each notification function type.
Input
fcn type
Output
Callback function pointer. Event to register the call back for. Pointer to reaction descriptor. Returns eInvalidArg if the function type is not appropriate for the event.
pRD
The following table lists all the events supported and their imposed function pointer type. As new events are supported, they will be added to this table. As other function types are supported for a specific event, they will also be added.
kOnDetachFile
Ami1FileNotifFcnPtr
kOnNewVersion
AmiFileVerNotifFcnPtr
kOnEraseVersion
AmiFileVerNotifFcnPtr
New version added to part or global design variables table. Note: on table updates all versions are erased and recreated. Version definition removed. Note: on table updates all versions are erased and recreated. Version activated on part (variables or suppression) or global design variables Conflict detected attaching versioning table Version table conflict resolved
Part activated New part created Part model updated Part erased
kOnFeatureAdded kOnFeatureRemoved
Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr
kOnFeatureRenamed kOnFeatureVersioned kOnFeatureSuppresse d kOnFeatureUnversion ed kOnFeatureUnsuppres sed kOnWorkGeomAdde d kOnWorkGeomRemo ved kOnWorkGeomRena med kOnWorkGeomVersio ned kOnWorkGeomSuppr essed kOnWorkGeomUnver sioned kOnWorkGeomUnsup pressed kOnFeatureReorder
Feature renamed Feature excluded through versioning Feature excluded through suppression Feature reactivated through change of version Feature reactivated through unsuppression Work geometry added Work geometry removed
Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr
Work geometry renamed Work geometry excluded through versioning Work geometry excluded through suppression Work geometry reactivated through change of version Work geometry reactivated through unsuppression (feature, destinationFeature, after (Boolean), context) Feature reordered, either before (after = kFalse) or after (after = kTrue) destinationFeature
Ami2KeyBoolNotifFcnPtr
kOnNewConstraint kOnEraseConstraint
Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr
Constraint Added (Assembly only for now) Constraint erased (Assembly only for now) Component definition created New component instanced
kOnNewCompDef kOnNewComp
Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr
Ami1KeyNotifFcnPtr Ami2KeyNotifFcnPtr Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr Ami2KeyNotifFcnPtr Ami1KeyNotifFcnPtr Ami1KeyNotifFcnPtr Ami2KeyNotifFcnPtr (newContext, oldContext, editContext) (Component, Target, InsertBefore, EditContext) (oldCompDef, newCompDef, editContext) (newCompDef, oldCompDef, editContext) (comp, scene, context) (comp, scene, context)
Scene created View created for component Component Definition erased Component erased Scene erased View of component erased Component renamed Component definition renamed Switch between active contexts component def(s) and scene(s). Subassembly component order changed
kOnReorderComp
Ami2KeyBoolNotifFcnPtr
Ami2KeyNotifFcnPtr
Component definition externalized notified at end of process Component definition localized notified at end of process Drawing view added Drawing view removed Drawing view edited Drawing view about to be regenerated/updated (this will include recalculation of hidden-lines, if appropriate). Detail views are not supported because they are not generated independently of their parent view. The drawing view has been copied, but the command/transaction has not been closed. If multiple views are copied within a single command, some of the other views might not have been copied yet. The view is in the process of being copied. Some processing has occurred. This notification is an appropriate time for external applications to use an AmiCloneNotifFcnPtr callback and participate in the deep-clone process.
Ami2KeyNotifFcnPtr
kOnViewCopied
Ami2KeyNotifFcnPtr
kOnViewPreCopy
Ami2KeyNotifFcnPtr, AmiCloneNotifFcnPtr
Ami3KeyNotifFcnPtr
Ami1KeyBoolNotifFcnPtr
Ami2KeyBoolNotifFcnPtr
Ami3KeyBoolNotifFcnPtr
Ami1FileNotifFcnPtr
AmiFileVerNotifFcnPtr
AmiKeyVerNotifFcnPtr
AmiCloneNotifFcnPtr
(AmiObjectKey* pObj1Key, AmiObjectKey* pObj2Key, AmiObjectKey* pObj3Key, Adesk::Boolean flag, AmiEventContextType contextType) (AmiFileDescrip* pFileDescrip, AmiObjectKey* pObjKey, AmiEventContextType contextType) (AmiFileDescrip* pFileDescrip, const char* pVersion, AmiEventContextType contextType) (AmiObjectKey* pObjKey, const char* pVersion, AmiEventContextType contextType) (AmiObjectKey* pKeyPreClone, AmiObjectKey* pKeyPostClone, AcDbIdMapping& idMap, AmiEventContextType contextType)
Versioning file event, possibly in relation to an object. Object key pointer may be NULL. Version event related to a file.
kTriggerObject
AmiObjectKey
Extract an attribute value on the given event reaction descriptor. This function is overloaded for all return types needed to support the current set of reaction attributes. These types are: Adesk::Boolean AmiObjectKey
Input
pReactDescrip A pointer to the descriptor. keyword Keyword for attribute (passed as an enum).
Output
value
RegAppName
Output
appId
AmiStatus amiRegisterEventReaction ( AmiReactDescrip *pReact, AmiAppId appId, const char* appName = NULL )
pReact
appId appName
Application id requesting the registration. The appId is used to bulk unregister reactions. You get an application id by calling amiRegisterApp. Application supporting the event.
AmiStatus amiRemoveEventReaction (AmiAppId regAppId, AmiReactDescrip* pReact =NULL, const char* appName = NULL )
Removes callbacks registered as described by pReact. All callbacks with the same event type and function pointer registered by the app ID will be removed. If pReact is null, all callbacks registered by regAppId will be removed. It is the caller's responsibility to delete pReact when finished. You get an application id by calling amiRegisterApp.
Input
ID of the Application requesting removal of callbacks Optional descriptor specifying which specific callback to remove. Name of application supporting the events, if needed.
Set an attribute value on the given event reaction descriptor. This function is overloaded for all return types needed to support the current set of reaction attributes. These types are: Adesk::Boolean AmiObjectKey
Input
pReactDescrip A pointer to the descriptor. keyword Keyword for attribute (passed as an enum). value The value for the specified attribute.
Miscellaneous
AmiStatus amiGetDesignMode
( AmiDesignEnvironmentType& currEnvironment, AmiDesignModeType& currMode, const char* appName = Designer_Assemblies ) Returns the current design environment (assembly, single part, proxy, multipart, or mixed) as each environment entails a set of restrictions. Also returns the current mode of the model, drawing or scene.
Input
appName
Output
Application being queried. Currently ignored. Current design environment. Current design mode.
currEnvironment currMode
AmiStatus amiGetKeyFromName
(const char* name, AmiKeyType keyType, AmiObjectKey*& pKey, AmiObjectKey* pScopeKey = NULL, const char* appName = NULL) Get an object key based on an object name. Given an object name, this function attempts to create a key of the given key type. The scope key is used to determine the starting point at which to look for the object. For example, given a key type of "Ami::featKey" and a part key as the scope, the function will look for a feature within that part with the given name and create a feature key to that feature. If
the scope key is NULL, it is assumed that we're looking for an object in the global scope such as a part or component definition. Function delegation is determined first by the scope key, then by the appName, and lastly by the key type. It is the callers responsibility to release the key returned. Note: only feature, parameter and sketch keys are supported.
Input
Name of object to get key for. Type of key that is to be created. Key to scope object. Application to create key. Pointer to created key.
pKey
AmiStatus amiSetDesignMode
( AmiDesignModeType wantedMode, const char* appName = Designer_Assemblies ) Sets the design mode to the indicated mode. The mode cannot be set to kUninitialized. This function is meant to be used to switch between modeling, drawing, scene, etc. Note: amiGetDesignMode returns the design environment in addition to the design mode, but only the mode can be set using this functionthe environment is fixed.
Input
wantedMode appName
Analysis
The Degrees of Freedom for assembly components and sketches are available through a descriptor object. The attributes on AmiDOFDescrip are listed in the table below. Not all of these attributes are supported in all DOF descriptors; a status of eAttValueNAV is returned for any unset attributes. The AmiDOFDescrip objects are read-only. They reflect the Degrees for Freedom for the specified object, at the time the descriptor is constructed.
dofAttNumVars
int
dofAttNumFreeVars dofAttNumDOF
int int
Y Y
dofAttTranslationAxis
dofAttRotationPoint
Y Y Y
components
components
The number of variables in the system. For example, for rigid-body motion in 3-space, this value will be six. For sketches, this value will depend upon the nature of the geometry in the sketch. The number of variables that are free (under-constrained). This number will always be less than or equal to dofAttNumVars. The number of rigid-body degrees of freedom in the system. For assembly components, where the only variables counted in dofAttNumVars are for rigid-body motion, this number will be equal to dofAttNumFreeVars. For descriptors for sketches, this number will be less than or equal to dofAttNumFreeVars. The number of rotational degrees of freedom. The number of translational degrees of freedom. The axes of rotation. If retrieved from the descriptor as a single AcGeLine3d, then the first axis is returned. If queried as an array, then all the axes of rotation are returned. The axes of translation. If retrieved from the descriptor as a single AcGeLine3d, then the first axis is returned. If queried as an array, then all the axes of translation are returned. A point on the axis of rotation (if needed). For example, if there are 3 RDOF and 1 TDOF in 3D space, then this point will be the pivot point on the part.
AmiStatus amiCheckInterference ( AmiCompKey* pKey1, AmiCompKey* pKey2, int& numClashes, AmiCompKey*** pComps1=(AmiCompKey***)NULL, AmiCompKey*** pComps2=(AmiCompKey***)NULL, AmiSolidKey*** pCommonVols=(AmiSolidKey***)NULL )
Checks for volume interference between two components. Most of the output parameters are optional, so the caller can control the amount of information returned. If the last argument is non-null, then new solids representing the interferences between the components are created and added to the database, and keys to those solids are passed back.
Input
pKey1 pKey2
Output
A pointer to the descriptor. Keyword for attribute (passed as an enum). The number of common values found.
numClashes
Input/Output
pComps1, pComps2
These are pointers to pointers to arrays of pointers to component definition keys. If non-null, the pointer referenced by these pointers are set to point to a newly allocated array of pointers to leaf components, such that the leaf components are part of the two subassemblies passed in, and each pair of components has interfering volume. If null, no component definition keys are created. pCommonVols This is a pointer to a pointer to an array of pointers to solid keys. If non-null, then the referenced pointer is set to point to a newly allocated array of solid key pointers. These keys are for the newly generated solids that represent the interference between the corresponding pair of leaf components. If null, no solid keys are created Note: To determine if there is any interference, without generating any keys and without adding any solids to the database, the last three arguments can be omitted and the numClashes argument can be tested for 0. One AmiCompKey array cannot be used without the other. They are meant to convey 2-tuples of components, such that each pair holds keys to interfering leaf components of the two subassemblies. When solid keys are returned, the solids are created and added to the database, and the last argument should be interpreted as the third part of 3-tuples (comp, comp, solid).
AmiStatus amiCheckInterferenceTrans ( AmiCompKey* pKey1, AmiCompKey* pKey2, int& numClashes, AmiCompKey*** pComps1 = (AmiCompKey***)NULL, AmiCompKey*** pComps2 = (AmiCompKey***)NULL, AcDb3dSolid*** pTransientVols = (AcDb3dSolid***)NULL )
Checks for volume interference between two components. Most of the output parameters are optional, so the caller can control the amount of information returned. If the last argument is non-null, then new solids are created and added to the database, and keys to those solids are passed back.
Input
pKey1 pKey2
Output
Key for the first component. Key for the second component. The number of common volumes found.
numClashes
Input/Output
pComps1, pComps2
These are pointers to pointers to arrays of pointers of comp keys. If non-null, the pointer referenced by these pointers is set to point to a newly allocated array of pointers to leaf components, such that the leaf components are part of the two subassemblies passed in, and each pair of comps has interfering volume. pTransientVols This is a pointer to a pointer to an array of pointers to AcDb3dSolids. If non-null, then the referenced pointer to set to point to a newly allocated array of AcDb3dSolid pointers. These keys are for newly generated solids that represent the interference between the corresponding pair of leaf components. Note: One AmiCompKey array cannot be used without the other. The caller can ask for all three parts of the 3-tuples (i.e. all three arrays), or no part (i.e. none of the arrays), or just the comp pairs (i.e. the first two arrays), or just the transient solids (i.e. the last array).
AmiStatus amiGetData ( AmiDOFDescrip* pDescrip, AmiDOFAttribute keyword,<datatype> value )
Extracts an attribute value from the given DOF descriptor. This function is overloaded for all return types needed to support the current set of DOF attributes. These types are: int AcGePoint3d, AcGeEntity3d. The keywords for attributes are defined by the AmiDOFAttribute enum. The following table lists the attribute keywords, the datatype, and brief descriptions. dofAttNumVars doffAttNumFreeVars dofAttNumDOF dofAttNumRDOF dofAttNumTDOF dofAttRotationAxis dofAttTranslationAxis dofAttRotationPoint int int int int int AcGeEntity AcGeEntity AcGePoint3d total number of variables number of free variables number of rigid-body DOF number of Rotation DOF number of Translation DOF first axis of rotation first axis of translation point on rotation axes
If the value for an attribute is NAV, meaning "Not A Value", then eAttValueNAV is returned as the AmiStatus and the content f the 'value' is undefined.
Input
pDescrip attr
Output
A pointer to the descriptor. Keyword for attribute (passed as an enum). The value for the specified attribute.
value
AmiStatus amiGetDataArray ( AmiDOFDescrip* pDescrip, AmiDOFAttribute keyword, int& numValues, <datatype> values )
Extracts an attribute value from the given DOF descriptor. This function is overloaded for all return types needed to support the current set of multi-valued DOF attributes. At present, this is limited to
AcGeEntity3d. The keywords for attributes are defined by the AmiDOFAttribute enum. The following table lists the attribute keywords, the datatype, and brief descriptions. dofAttRotationAxis dofAttTranslationAxis AcGeEntity array AcGeEntity array (free) axes of rotation (free) axes of translation
If the value for an attribute is NAV, meaning "Not A Value", then eAttValueNAV is returned as the AmiStatus and the content of the 'value' is undefined.
Input
pDescrip attr
Output
numValues The number of elements in the array. values The array of values for the attribute.
AmiStatus amiGetDOFDescrip ( AmiObjectKey* pKey, AmiDOFDescrip*& pDescrip )
Returns Degree Of Freedom information for the given object. The descriptor can be queried for individual attribute values. While the input can be any type of object key, this function is only meaningful for a few object types (e.g. components and sketches) and will return an error status for most types. For components, the DOF descriptor holds the Degrees of Freedom for the component in the scope of the directly owning subassembly. Any geometry in the descriptor (e.g. axes) is transformed to reflect the full scope implied by the key.
Input
pKey
Output
A pointer to an object key. A pointer to a newly created DOF descriptor. It is the caller's responsibility to delete this object.
pDescrip
Calculates the mass properties for a set of components, parts, AutoCAD solids, or a volume enclosed by surfaces. An assumption is made that all keys in the passed-in array are of the same type. If the first key is not to a part, component, AutoCAD solid, or surface key, an error is returned. The mass prop information is returned in WCS. The mass properties structure (amiMassProps) is defined in header file mibody.h.
Input
size pObjKeys
Output
Finds the minimum distance between two components. Only leaf-node components are currently supported.
Input
pKey1 pKey2
Output
Key for the first component. Key for the second component. The minimum distance between the two components. First end-point of a minimum distance line between the two components. Second end-point of a minimum distance line between the two components.
Geometry Creation
AmiStatus amiCreateSurfFromGeom
( AmiSurfKey*& pSurfKey, const AcGeSurface* pGeSurf, int numLoops, const AcGeCurveBoundary* pLoops, const char* appName = AutoSurf ) Creates a bounded (trimmed) surface and returns a key to it. It is the callers responsibility to release the key.
Input
pGeSurf
Pointer to GeLib surface used in defining the surface that will be created. For the initial revision only, AcGeNurbsSurface as well as AcGeOffsetSurface based on a NURBS surface are valid inputs. Future revisions are expected to support a broader range of surface types. numLoops Number of loops in array pLoops. If this parameter is set to zero, an untrimmed surface will be created. pLoops Array of boundary loops. This AcGeCurveBoundary can support model space and parameter space curves that are of type AcGeNurbCurve2d. Future revisions are expected to support using either model space or parameter space trim boundary curves, as well as AcGeCurves of all types. NOTE: Loop orientation is important. Outer loops must be counterclockwise and inner loops must be clockwise. All Loops must map to closed paths in model space. appName Name of application module to perform the function. The default application is AutoSurf.
Output
pSurfKey
AmiStatus amiCreateSurfArrayFromGeom
( int& numKeys, AmiSurfKey**& pSurfKeys, const AcGeSurface* pGeSurf, int numLoops, const AcGeCurveBoundary* pLoops, const char* appName = AutoSurf ) Creates a set of bounded (trimmed) surfaces and returns keys to them. It is the callers responsibility to release the keys.
Input
Pointer to GeLib surface used in defining the surface that will be created. For the initial revision only, AcGeNurbsSurface as well as AcGeOffsetSurface based on a NURBS surface are valid inputs. Future revisions are expected to support a broader range of surface types. appName Name of application creating the surface. numLoops Number of loops in array pLoops. If this parameter is set to zero, an untrimmed surface will be created.
pGeSurf
pLoops
Array of boundary loops. This AcGeCurveBoundary can support model space and parameter space curves that are of type AcGeNurbCurve2d. Future revisions are expected to support using either model space or parameter space trim boundary curves, as well as AcGeCurves of all types. NOTE: Loop orientation is important. Outer loops must be counterclockwise and inner loops must be clockwise. All loops must map to closed paths in model space. Number of keys returned. Array of pointers to keys to the new surface.
Output
numKeys pSurfKeys
Drawing Manager
Introduction
The Drawing Manager allows for editing of views and annotations through AmiDescrip descriptor objects. See page Error! Bookmark not defined. for a discussion of AmiDescrip and how it is used in the API. Several attributes can take on values that are reference geometry or non-reference geometry. For example, the orientation plane (vwAttOrientnPlane) of a base view can be a reference to a face of a part or it can simply be the XY-plane in world coordinates. If an attribute value is parametrically associative, then values are passed using geometry keys, otherwise AcGeEntity3d objects are used. If the attribute value of an existing database object is requested as an AmiObjectKey and the query fails with error status eGKeyNotSupported, then this is an indication that the underlying geometry is nonassociative and that the same attribute should be requested using the AcGeEntity3d overload. The AcGeEntity3d representation is always available because there is always an AcGeEntity3d representation for reference geometry.
Views
The following table lists all of the view attributes currently defined in the Drawing Manager, along with a brief description of each. These same attributes are then separated by view-type, as several of these attributes are applicable to only some types of view. New keywords will be added to this list as the set of Drawing Manager attributes supported by the MCAD API grows.
vwAttAHLdisplayOn
Adesk::Boolean
All
AmiHiddenLineTreatment
All
vwAttScale
double
All
vwAttHatchAHL
Adesk::Boolean
Sectioned
vwAttSectionLabel
const char*
Sectioned
vwAttSectionCut
Y Y Y
AcGeEntity3d
Full sectioned
AcGeEntity3d array
Half sectioned
vwAttSectionCutDir vwAttOrientation
AmiSectionCutDir AmiOrientationType Y
Y Y
AmiNormalOrientnType
Scale-factor for the view. If absolute scaling is used, then this scale-factor is applied to the component size. If relative scaling is used, then this scalefactor is applied to the scale of the parent view. The value should always be positive. Absolute/Relative scaling. Center-point of the view. The extents of the viewport box. The array holds two points: the lower-left and upper-right. Label for the view. The label is displayed for Detail views only. The type of section. There is a type, kSecNone, to indicate no sectioning. Section hatching on/off flag. This attribute is only applicable to sectioned views. Normally hatch patterns are not trimmed w.r.t hidden-line calculations. If vwAttHatchAHL is kTrue, then the hatch pattern participates in hiddenline calculations. Label for the section. This label appears in both the described view and in the parent view. This attribute is read-only for base views with no preexisting label, as there is no parent view in which is place the label. The cutting line/plane/point for a sectioned view. A pair of cutting planes, when applicable. The cutting point. When set using AcGePoint3d, the cutting point will be fixed. Can be queried as AcGePoint3d when fixed and when reference geometry. The cutting plane. When set using AcGePlane, the cutting plane will be fixed. Can be queried as AcGePlane when fixed and when reference geometry. The cutting planes (there are two). Similar to the use of AcGePlane with full-sections. The cutting direction of the halfsection. Vantage-point. This is an enum used to indicate the standard orientations for ortho and iso views. Orientation transform matrix. This is applicable to any type of view. Base-view orientations are represented as plane-axis-direction. This is the plane component of this triple. When the plane is reference geometry, amiObjectKey is used; when it is fixed geometry AcGePlane is used.
Aux-view orientations can be defined in terms of a work-plane, passed as an AmiObjectKey. The AmiNormalOrientnType representation can be used to reverse the normal of the plane.
vwAttOrientnAxis
AcGeEntity3d, AmiObjectKey
Base
vwAttOrientnAxisDir
AmiAxisDirection
Base
vwAttGap
double
Broken views
vwAttRefPoint1
AmiObjectKey
Detail, Aux
vwAttRefPoint2
AmiObjectKey
Aux
vwAttRefBoxUL
Detail
vwAttRefBoxLR
Detail
vwAttModelEnts
AmiObjectKey array
All
The axis component of the plane-axisdirection representation of base-view orientations. When the axis is reference geometry amiObjectKey is used; when it is fixed geometry AcGeLine is used. The axis direction for the plane-axisdirection representation of base view orientations. The gap in a broken view. This attribute is applicable to broken views only. Reference Geometry in model-space. For a detail-view, this is the point in the parent view that is being detailed. For an aux-view, this is the first vertex (of two) that defines the axis of rotation for the orientation of the aux-view with respect to the parent view. Reference Geometry in model-space. For an aux-view, this is the second vertex that defines the axis of rotation for the orientation of the aux-view with respect to the parent view. Upper-left corner of detailed box in parent view. This point is relative to vwAttRefPoint1 in paper-space and is passed as a pair of x, y offsets. Lower-right corner of detailed box in parent view. This point is relative to vwAttRefPoint1 in paper-space and is passed as a pair of x ,y offsets. The model entities contained in the view. The model entities can be part keys, solid keys, and scene keys. If a scene key is in the array, then it must be the only key in the array. Turns on/off the display of parametric dimensions in the view. Turns on/off the display of tapped-hole annotations in the view. The layout or sheet on which the view resides. The layout or sheet on which the view is placed. Indicates if parametric dimensions are displayed in the view. Indicates if tapped-hole lines are displayed in the view. Turns on/off Standard Part Representation for 3D standard parts in view. The Standard Part Representation is a 2D representation of a 3D Standard Part that conforms to drafting standards. This attribute has no affect when the MDT Power Pack is not loaded since the Standard Parts functionality is in the Power Pack. Also, this has no affect if there are no Standard Parts in the view or if the view orientation does not allow for a standard 2D representation for the parts (e.g. iso views). This is the center of the view in modelspace coordinates.
vwAttCenterPt
AcGePoint3d
All
When descriptors are used to create new database objects (e.g. new views), some of the read-only attributes can be set. Thus, there are several attributes which are write-once, meaning that they can
be set when the view is created but thereafter are read-only. Other attributes have values that are derived from other properties of the view and cannot be set even when creating a new view. For example, the matrix representation on the view orientation is derived from the other orientation representations (e.g. AmiViewOrientation) and cannot be set directly, even when creating a new view. Several attributes are mandatory for view creation . The following tables list the attributes applicable to each type of view and describe the roles those attributes play during view creation. For base views, there is no parent view, the scale-type must be absolute, and the orientation is represented as a triple of plane-axis-direction. The orientation geometry can be parametrically associative or not. If it is associative, then values are passed using geometry keys, otherwise AcGeEntity3d objects are used. In the tables below, the second column describes any constraints on allowable values for the specified attribute. The third column, labeled Role in view creation indicates if the attribute must have a nonNAV value when the descriptor is used to create a new view. If this entry is blank, then the attribute is optional and can be NAV. The fourth column indicates if the attribute is read-only, write-once, or read/write (this last case is indicated by a blank entry in column four).
vwAttViewType vwAttDisplayType
kBaseVw
kModelSpace (unprocessed model space entities) kWireFrame (wireframe-no hidden line calculations) kWireFrameWithSilh (wireframe with no hidden line calculations, but with silhouette calculations) kNoOcclusion (hidden line calculations, but no occlusion) kNoOcclusionWithTang (hidden line calculations are on, but no occlusion calculations. Occlusion refers to edges covering other edges (points), as opposed to regular hidden line calculations which involve surfaces covering edges) kNoOcclusionWithTang (hidden line calculations are on, occlusion calculations are off, and tangencies are displayed. A tangency is an edge where the adjoining faces have equal normals along the length of the edge. kSimpleOcclusion (hidden line calculations with simple occlusion. This means that spline curves are not considered in occlusion calculations.) kSimpleOcclusionWithTang (hidden line calculations, with simple occlusion, and with tangencies displayed) kOcclusion (hidden line calculations, with full occlusion) kOcclusionWithTang (Hidden line calculations, with full occlusion, and tangencies displayed kTrue, kFalse, kHiddenLinesDisplayed, kHiddenLinesNotDisplayed, kHiddenLinesDiscarded Any positive double kVwSclAbs Any AcGePoint3d Pair of AcGePoint3d See separate table Any string kBase, AcGeMatrix A geometry key to a reference plane or an AcGePlane3d A geometry key to a reference line or an AcGeLine3d kXAxisPos, kXAxisNeg, kYAxisPos, kYAxisNeg A single scene key or a list of keys to parts and solids
Write-once
vwAttAHLdisplayOn
vwAttScale vwAttScaleType vwAttLocation vwAttExtents vwAttSection vwAttLabel vwAttOrientation vwAttOrientnPlane vwAttOrientnAxis vwAttOrientnAxisDir vwAttModelEnts
mandatory Read-only mandatory Read-only mandatory mandatory mandatory mandatory mandatory mandatory Read-only Write-once Write-once Write-once
vwAttLayout
vwAttShowParDims vwAttShowParDims
The scale for ortho-views is locked into the scale of the parent. The API permits the scale to be altered within the descriptor, but any changes made to the scale will not be reflected in the view when the descriptor is applied in a view-creation or edit operation.
kOrthoVw
kWireFrame, kHiddenTangDisp, kHiddenNoTangDisp kTrue, kFalse, kHiddenLinesDisplayed, kHiddenLinesNotDisplayed, kHiddenLinesDiscarded Any positive double kVwSclAbs, kVwSclRel Any AcGePoint3d Pair of AcGePoint3d See separate table Any string AmiOrthoOrientation (kLeft, kRight, kTop, kBottom) AmiDwVwKey Any Mechanical Desktop layout.
mandatory
Write-once
Read-only Read-only mandatory Read-only mandatory mandatory mandatory Optional: will default to current layout
Write-once
vwAttShowParDims vwAttShowParDims
kIsoVw
kWireFrame, kHiddenTangDisp, kHiddenNoTangDisp kTrue, kFalse, kHiddenLinesDisplayed, kHiddenLinesNotDisplayed, kHiddenLinesDiscarded Any positive double kVwSclAbs, kVwSclRel Any AcGePoint3d Pair of AcGePoint3d See separate table Any string AmiIsoOrientation (kTopRight, kBottomLeft, kTopLeft, kBottomRight) AmiDwVwKey Any Mechanical Desktop layout.
mandatory
Write-once
mandatory mandatory mandatory Read-only mandatory mandatory mandatory Optional: will default to current layout Write-once
vwAttShowParDims vwAttShowParDims
For detail-views the vwAttRefPoint1 attribute is used represent the reference point for the center of focus of the detailed area. This can be any point reference on the model-space entities of the parent view. The vwAttBoxUL and vwAttBoxUL attributes represent the detailed area. The detailed area is always a rectangle and is represented as X,Y offsets relative to the reference point (vwAttRefPoint1). The detailed area need not include the reference point.
kDetVw
kWireFrame, kHiddenTangDisp, kHiddenNoTangDisp
mandatory
Write-once
vwAttAHLdisplayOn
vwAttScale vwAttScaleType vwAttLocation vwAttExtents vwAttSection vwAttLabel vwAttRefPoint1 vwAttBoxUL vwAttBoxLR vwAttParent vwAttLayout
kTrue, kFalse, kHiddenLinesDisplayed, kHiddenLinesNotDisplayed, kHiddenLinesDiscarded Any positive double kVwSclAbs, kVwSclRel Any AcGePoint3d Pair of AcGePoint3d See separate table Any string AmiObjectKey to reference point Pair of X,Y offsets from vwAttRefPoint1 to upper-left of detail box. Pair of X,Y offsets from vwAttRefPoint1 to lower-right of detail box. AmiDwVwKey Any Mechanical Desktop layout.
mandatory mandatory mandatory Read-only mandatory mandatory mandatory mandatory mandatory Optional: will default to current layout Write-once
Write-once
vwAttShowParDims vwAttShowParDims
For aux-views, the vwAttRefPoint1 and vwAttRefPoint2 attributes are used hold the reference points that define the axis of rotation for the view orientation. These are reference points on the model-space entities of the parent view. The ref-point representation of the orientation cannot be used in conjunction with the work-plane representation (vwAttOrientnPlane). An aux-view descriptor can hold either one representation or the other, but not both. The AmiOrthoOrientation representation of the vwAttOrientation attribute is used to convey the direction of rotation. The extent of rotation is always 90 degrees.
kAuxVw
kWireFrame, kHiddenTangDisp, kHiddenNoTangDisp kTrue, kFalse, kHiddenLinesDisplayed, kHiddenLinesNotDisplayed, kHiddenLinesDiscarded Any positive double Any positive double kVwSclAbs, kVwSclRel Any AcGePoint3d Pair of AcGePoint3d See separate table Any string AmiOrthoOrientation (kLeft, kRight, kTop, kBottom) AcGeMatrix AmiObjectKey to reference point AmiObjectKey to reference point
mandatory
Write-once
Read-only Read-only Read-only mandatory Read-only mandatory mandatory Read-only Write-once Write-once mandatory Optional: will default to current layout
vwAttRefPoint1 vwAttRefPoint2
vwAttOrientnPlane
vwAttParent vwAttLayout
AmiObjectKey to work-plane
AmiDwVwKey Any Mechanical Desktop layout.
Write-once Write-once
vwAttShowParDims vwAttShowParDims
At present, the API does not support creation of broken views. A broken view is a type of base view and therefore has no vwAttParent. The vwAttGap attribute holds the size of the break in the broken view.
KBrokenVw
kWireFrame, kHiddenTangDisp, kHiddenNoTangDisp
N/A N/A
vwAttAHLdisplayOn
kTrue, kFalse, kHiddenLinesDisplayed, kHiddenLinesNotDisplayed, kHiddenLinesDiscarded Any positive double kVwSclAbs Any AcGePoint3d Pair of AcGePoint3d See separate table Any string AcGeMatrix Any positive double Any Mechanical Desktop layout.
N/A
N/A N/A N/A N/A Mandatory N/A N/A Optional: will default to current layout
Read-only Read-only
Read-only
vwAttShowParDims vwAttShowParDims
If an API call is made with a descriptor type and attribute type combination that is not listed in the above tables, then and error status is returned and no action is taken (the error status is eNotApplicable, or in some cases, eAttTypeMismatch). Sectioning information can be applied to base-views and ortho-views. For other types of views, the sectioning settings from the parent view are used in the child view. For those views, only the hatch flags (vwAttHatchAHL, vwAttHatchOnFlag) can be changed independently of the parent view. All other section settings in a descriptor used in a view-creation or edit operation on these other view types should agree with the parent view section or else be set to NAV. The vwAttSectionType attribute must be set (i.e. cannot be NAV) to create new views. However, the value can be kNone, in which case the view is unsectioned and all the other sectioning attributes listed in Table 17: Drawing Manager View Section Types should be NAV. The table below lists the attributes for each type of section in Drawing Manager views. Most of the sectioning information is straightforward. However, the representation of cutting information varies depending upon the type of section. Full-section cutting planes can be represented as a single reference point or as a plane. Half-section cutting planes can be represented as a single point or as a pair of planes. Offset-sections, aligned-sections and breakout-sections use a cutting-line, which is passed as a sketch key.
kTrue, kFalse Any string kSecFull AcGePoint3d, A point key mandatory mandatory Write-once Write-once The point must be set as a reference point using a geometry key. It can be queried as AcGePoint3d or as a key. Queries return NAV if the cut is a plane instead of a point. The plane can be set as a fixed AcGePlane or as a geometry key to a reference plane. The plane can always be queried as AcGePlane. Queries return NAV if the cut is a point instead of a plane.
Half section
vwAttSectionType
kSecHalf
mandatory
Write-once
vwAttSectionCut
AcGePoint3d, A point key Two AcGePlane, Two Plane keys kCutRight, kCutLeft kSecOffSet Cutting-line sketch kSecAligned Cutting-line sketch Cutting-line sketch, AcGePlane, plane key AcGePoint, point key, AcGePlane, plane key
mandatory
Write-once
mandatory mandatory mandatory mandatory mandatory mandatory Write-once Write-once Write-once Write-once Write-once
Handled in the same manner as a point-cut for a full-section. A pair of planes, either fixed AcGePlanes or reference planes passed as geometry keys. Direction of half-cut cutting line extension. Cutting-line is passed as a sketch key. Cutting-line is passed as a sketch key. Cutting-line is passed as a sketch key. Both a cutting line and a plane specification must be used. Both a plane specification and point specification are needed.
Aligned section
Break-out section
Radial section
kSecRadial
mandatory
Write-once
For a descriptor with vwAttSectionType set to kSecNone, all other section attributes should be NAV. Note that sectioning information is mandatory for creation of base views. Even for unsectioned base views, the vwAttSectionType attribute should be set explicitly to kSecNone. For child views (e.g. ortho views), sectioning information is not mandatory for view creation. If the vwAttSectionType is NAV when creating child views, the view will have the same sectioning as the parent.
AmiStatus amiAddDataArray (AmiDwVwDescrip* pViewDescrip, AmiViewAttribute attr, int numValues, <Input Type>* values)
Adds the given array to the current value of the given attribute within the descriptor. If the current value of the given attribute is NAV, then eAttValueNAV is returned. This function is overloaded for all input types needed to support the current set of multi-valued view attributes where union/append is meaningful. This type is: AmiObjectKey The keywords for attributes are defined by the AmiViewAttribute enum. The following table lists the attribute keywords, the datatype, and brief descriptions. vwAttModelEnts
Input
AmiObjectKey
Model entities
A pointer to the descriptor. Keyword for attribute (passed as an enum). The length of the array. The array of new values for the specified attribute.
Create a new view from the descriptor. NOTE: This function cannot be used in a "transparent" transaction. It should be used in modal transactions. Broken views are not yet supported by this function. It is the callers responsibility to release the newly created key.
Input
pViewDescrip
Output
pNewViewKey
AmiStatus amiCreateDwVwDescrip ( AmiViewType viewType, AmiDwVwDescrip*& pViewDescrip, const char* appName = NULL )
Returns an empty view descriptor of the given type. An "empty" view descriptor is a descriptor where all values are NAV. It is the callers responsibility to release the descriptor.
Input
viewType appName
Output
The type for the view descriptor. Name of related application. If NULL is specified then a default application will be used. A pointer to an empty view descriptor.
pViewDescrip
Apply the view descriptor to the given view. The view is updated to reflect the values in the descriptor. Any slots in the view that are NAV are ignored (i.e. treated as "don't care"). Any slots that are read-only, are not NAV, and are different from the current values for the view, will result in an error status (eAttReadOnly). Note To refresh the screen and bring all dependent entities up to date, calls to this function should be followed by AMUPDATE.
Input
pViewKey PViewDescrip
A pointer to a key for the view to be edited. A pointer to the descriptor to be applied.
Returns kTrue if and only if the given descriptor is of the given type.
Input
pViewDescrip viewType
Output
A pointer to a view descriptor. A view descriptor type. A flag indicating if the descriptor is of the given type.
fIsKindOf
The view for which the layers are to be frozen. The number of layers in pLayers array. An array of object ids for layers.
Returns a view key for each view in the current drawing. It is the callers responsibility to release all keys in the array, and then delete the array.
05/12/2001 Page 184
Input
pLayout
Output
Optional. If non-null, then the output will be confined to the given layout. Otherwise, all active views on all layouts are returned. The size of the array An array of pointers to newly created keys for all active views.
numViews pViews
Extracts an attribute value from the given view descriptor. This function is overloaded for all return types needed to support the current set of view attributes. These types are: double char* AmiViewType AmiSectionType AmiSectionCutDir AmiHiddenLineTreatment AmiAxisDirType Adesk::Boolean AmiViewDisplayType AmiOrientationType AmiViewScaleType AcGePoint3d AcGeMatrix3d AcGeEntity3d AmiObjectKey* AcDbObjectID The keywords for attributes are defined by the AmiViewAttribute enum. The View and Annotation Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. Attributes that take on array values are handled by a separate function (amiGetDataArray). If the value for the attribute is NAV, meaning "Not A Value", then eAttValueNAV is returned as the AmiStatus and the content of the 'value' is undefined. It is the caller's responsibility to free, as appropriate, any returned value.
Input
pViewDescrip attr
Output
A pointer to the descriptor. Keyword for attribute (passed as an enum). The value for the specified attribute.
value
AmiStatus amiGetDataArray (AmiDwVwDescrip* pViewDescrip, AmiViewAttribute attr, int& numValues, <Return Type>*& values)
Extracts an array of values for a multi-valued attribute. This function is overloaded for all return types needed to support the current set of view attributes. These types are: AmiObjectKey* AcGePoint3d* AcGeEntity3d*
double The keywords for attributes are defined by the AmiViewAttribute enum. The View and Annotation Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. This function supports any of those attributes which have an array datatype. At present those attributes are vwAttModelEnts, vwAttExtents, vwAttRefBoxUL, vwAttRefBoxLR, and vwAttSectionCut. If the value for the attribute is NAV, meaning "Not A Value", then eAttValueNAV is returned as the AmiStatus and the content of the 'value' is undefined. It is the callers responsibility to delete the array. It is the caller's responsibility to free, as appropriate, any returned value.
Input
pViewDescrip attr
Output
A pointer to the descriptor. Keyword for attribute (passed as an enum). The length of the array. The array of values for the specified attribute.
numValues values
Returns a descriptor for the given view. The descriptor holds information on the current state of the view. The descriptor is de-coupled from the view (it does not change as the view changes). It is the callers responsibility to release the descriptor.
Input
pViewKey
Output
pViewDescrip
Returns an object key for each modeling object in the given view. The object keys returned can be part keys, scene keys, or body keys. It is the callers responsibility to release the keys in the array and to delete the array.
Input
pViewKey
Output
A key for the view for which to create object keys. The size of the array. An array of pointers to keys for all of the model entities for the view.
size pKeys
This function returns a key to the parent view of the given view. If the given view is a base view, which has no parent, then a error status is returned (eBaseView). It is the callers responsibility to release the key returned.
Input
pViewKey
Output
A pointer to a view key. A pointer to a key for the parent of the view.
pParentKey
Returns the number of active views on the given layout (also called a sheet).
Input
pLayout
Output
Optional. If non-null, then the output will be confined to the given layout. Otherwise, all active views on all active layouts are counted. The count.
numViews
Sets an attribute value from the given view descriptor. This function is overloaded for all input types needed to support the current set of view attributes. These types are: double char* AmiViewType AmiSectionType AmiViewDisplayType AmiSectionCutDir AmiHiddenLineTreatment AmiAxisDirType Adesk::Boolean AmiOrientationType AmiViewScaleType const AcGePoint3d& AcGeEntity3d const AcGeMatrix3d& AmiObjectKey* AcDbObjectID The keywords for attributes are defined by the AmiViewAttribute enum. . The View and Annotation Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. Attributes that take on array values are handled by a separate function (amiGetDataArray). In addition, the special value Ami:att_NAV can be used to set the specified attribute to "Not A Value". NAV attributes are treated as "unset" or "don't care" values when applying the descriptor to a view in amiDwEditView().
Input
A pointer to the descriptor. Keyword for attribute (passed as an enum). The value for the specified attribute.
AmiStatus amiSetDataArray (AmiDwVwDescrip* pViewDescrip, AmiViewAttribute attr, int numValues, <Input Type>* values)
Sets an attribute value from the given view descriptor. This function is overloaded for all input types needed to support the current set of view attributes. These types are: AmiObjectKey* AcGePoint3d* AcGeEntity3d* double The keywords for attributes are defined by the AmiViewAttribute enum. The View and Annotation Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. This
05/12/2001 Page 187
function supports any of these attributes which have an array datatype. At present those attributes are vwAttModelEnts, vwAttExtents, vwAttRefBoxUL, vwAttRefBoxLR, and vwAttSectionCut. In addition, the special value AmiDwAtt_NAV can be used to set the specified attribute to "Not A Value". NAV attributes are treated as "unset" or "don't care" values when applying the descriptor to a view in amiDwEditView().
Input
A pointer to the descriptor. keyword for attribute (passed as an enum). The length of the array. The array of values for the specified attribute.
AmiStatus amiThawLayers
(AmiDwVwKey* pView, int numLayers, AcDbOjectId* pLayers)
The view for which the layers are to be thawed. The number of layers in pLayers array. An array of object ids for layers.
Annotations
The following table lists all of the annotation attributes currently defined in the Drawing Manager, along with a brief description of each. New keywords will be added to this list as the set of Drawing Manager attributes supported by the MCAD API grows.
annAttAttachPt
AmiObjectKey
annAttLocation
AcGePoint3d
annAttComputedVal annAttMeasuredVal
double double
Y Y
annAttContent
annAttGeometry
AcDbObjectId array
AcDbObjectId array, AmiGeomKey array
Dimensions, User-defined
User-defined
annAttBorder
AcGeEntity3d, AmiObjectKey
Detail Symbol
Creates a new annotation and adds it to the database. A key to the new annotation is returned. The annotation remains empty; geometry can be added via other functions. This function is limited to AcDmUserDefnNote only. It is the callers responsibility to release the newly created key.
Input
pDescrip pView
Output
A point to an annotation descriptor holding arguments for the creation operation. The view in which to place the annotation.
Returns an empty annotation descriptor of the given type. An "empty" annotation descriptor is a descriptor where all values are NAV. It is the callers responsibility to release the descriptor.
Input
annotType appName
Output
The type for the descriptor. Name of related application. If NULL is specified then a default application will be used. A pointer to an empty descriptor.
pAnnotDescrip
Returns kTrue if and only if the given descriptor is of the given type.
Input
pAnnotDescrip annotType
Output
A pointer to a annotation descriptor. An annotation descriptor type. A flag indicating if the descriptor is of the given type.
fIsKindOf
Apply the annotation descriptor to the given view. The view is updated to reflect the values in the descriptor. Any slots in the view that are NAV are ignored (i.e. treated as "don't care"). Any slots that are read-only, are not NAV, and are different from the current values for the view, will result in an error status (eAttReadOnly). Note To refresh the screen and bring all dependent entities up to date, calls to this function should be followed by AMUPDATE.
Input
pAnnotKey pAnnotDescrip
AmiStatus amiGetData
A pointer to a key for the annotation to be edited. A pointer to the descriptor to be applied.
Extracts an attribute value from the given annotation descriptor. This function is overloaded for all return types needed to support the current set of annotation attributes. The keywords for attributes are defined by the AmiAnnotAttribute enum. The View and Annotation Attribute Keywords Table lists the attribute keywords, the datatype, and brief descriptions. If the value for the attribute is NAV, meaning "Not A Value", then eAttValueNAV is returned as the AmiStatus and the content of the 'value' is undefined. It is the caller's responsibility to free, as appropriate, any returned value.
Input
pAnnotDescrip attr
Output
A pointer to the descriptor. The keyword for attribute (passed as an enum). The value for the specified attribute.
value
Returns a descriptor for the given annotation. The descriptor holds information on the current state of the annotation. The descriptor is de-coupled from the annotation (it does not change as the annotation changes). It is the callers responsibility to release the descriptor.
Input
pAnnotKey
Output
pAnnotDescrip
Returns a key for the view to which the given annotation is attached. It is the callers responsibility to release the key.
Input
pAnnotKey
Output
A pointer to an annotation key. A pointer to a new key for the associated view.
pOwnerView
AmiStatus amiGetDwVwAnnots ( AmiDwVwKey* pViewKey, AmiAnnotType annotType, int& numNotes, AmiDwAnnotKey**& pNotes )
Returns an annotation key for each annotation of the given type in the view. AmiAnnotType includes a general type that matches all annotation types so this function can be used to get all annotations in the view. It is the callers responsibility to release all keys in the array and delete the array. At present, filtering for specific types of annotations in not supported and the annotType argument must be kNoteGeneral.
Input
pViewKey annotType
Output
A view key for the view. The type of annotations to be selected. The size of the array returned. An array of ptrs to note keys for this view.
numNotes pNotes
Moves the annotation by the given displacement vector. Not all annotations can be moved in this way. For annotations that cannot be moved freely, eNotApplicable is returned.
Input
pAnnotKey displacement
Sets an attribute value from the given annotation descriptor. This function is overloaded for all input types needed to support the current set of view attributes. The keywords for attributes are defined by the AmiAnnotAttribute enum. The View and Annotation Attribute Keywords Table on page 176 lists the attribute keywords, the datatype, and brief descriptions. In addition, the special value Ami:att_NAV can be used to set the specified attribute to "Not A Value". NAV attributes are treated as "unset" or "don't care" values when applying the descriptor to a view in amiDwEditView().
Input
A pointer to the descriptor. Keyword for attribute (passed as an enum). The value for the specified attribute.
Scenes
At present, support for scenes is limited. The explosion factor and the component definition for the scene can be obtained from a scene key. Basic properties for components within scenes (e.g. position and visibility) can be obtained from a descriptor for scene-components. The scene-component descriptor, AmiSceneCompDescrip, is similar to view descriptors and annotation descriptors. The same semantics for NAV is used here. The following table lists the attributes currently defined for scene-components, along with a brief description of each. New keywords will be added to this list as the set of attributes supported by the MCAD API grows.
scpAttIsSuppressed scpAttExplodeFactor
Adesk::Boolean double
Creates a new scene for the given component definition and return a key to the scene. It is the caller's responsibility to release the new scene key.
Input
pCompDefKey Key to a component definition for the new scene. sceneName Name for the new scene.
Output
pSceneKey
Creates an "empty" scene component descriptor. All of the attribute values in the newly created descriptor are attNAV.
Input
appName
Output
pDescrip
Editing function for scene components. The component key is a modeling key. The corresponding entity within the scene is edited, using the attribute values in the given descriptor. If there is no instance of the given component in the scene, an error status is returned. If an attempt to edit a readonly attribute is made, an error status is returned.
Input
A scene key. A modeling component key. A descriptor holding the new values.
none
AmiStatus amiGetAllScenes ( int& numKeys, AmiSceneKey**& pKeys, char appName = NULL )
appName
Output
Name of the application to perform the function (optional). Number of keys being returned. A pointer to an array of pointers to scene keys.
numKeys pKeys
Extracts an attribute value from the given descriptor. This function is overloaded for all return types needed to support the current set of attributes. These types are: double char* Adesk::Boolean (int) AcGeMatrix3d See table for a list of the scene-comp attributes and the corresponding data types.
Input
pDescrip attr
Output
A pointer to the descriptor. Keyword for attribute (passed as an enum). The value for the specified attribute.
value
Returns a pointer to a key for the CompDef for the given scene. It is the callers responsibility to release the CompDef key returned.
Input
pSceneKey
Output
pCompDefKey A pointer to a new key for the CompDef of the assembly in the scene.
AmiStatus amiGetSceneCompDescrip (AmiSceneKey* pSceneKey, AmiCompKey* pCompKey, AmiCompInSceneDescrip*& pDescrip)
Creates a descriptor object holding scene component attribute values. The descriptor is de-coupled from the scene and component; it can be edited independently and applied to any component in any scene.
Input
pSceneKey pCompKey
Output
A key for the scene. A key to a model-space component. A pointer to a descriptor for the given view. It is expected that the component corresponds to a component in the compdef for the scene. An error status is returned if it isn't.
pDescrip
pSceneKey
Output
factor
AmiStatus amiGetSceneLock
pSceneKey
Output
flag
Sets an attribute value from the given descriptor. This function is overloaded for all input types needed to support the current set of view attributes. These types are: double, char*, Adesk::Boolean (int),
05/12/2001 Page 193
const AcGeMatrix3d& See table for a list of the scene-comp attributes and the corresponding data types.
Input
A pointer to the descriptor. Keyword for attribute (passed as an enum). The value for the specified attribute.
AmiStatus amiSetSceneLock
pSceneKey
Output
Key to a scene. If kTrue then the scene will be locked; else it will be unlocked.
flag
Clears the custom AHL settings for the view. All custom AHL settings for the specified view are cleared.
Input
appId pKey
Registered ID for the (external) application that is controlling the AHL settings. You get an application id by calling amiRegisterApp. A pointer to a key on the view.
Clears the hidden line calculation settings for the specified object in the specified view. The third argument can be NULL. The custom hidden line settings normally apply to specific objects in the views. However, for the purposes of hidden line customization, every view has one "null" object and hidden line settings can be applied to these "null" objects. This is useful when there is custom geometry to be added to a view, where the custom geometry does not "replace" any model geometry.
Input
Registered ID for the (external) application that is controlling the hidden line calcuation settings. You get an application id by calling amiRegisterApp. A pointer to a key on the view. A pointer to a component in the view, or NULL.
AmiStatus amiGetCustomAHL
(AmiAppId appId, AmiDwVwKey* pDwVwKey, AmiObjectKey* pObjKey, Adesk::Boolean& bSectioning, int& numGeoms, AmiGeomKey**& paGeomKeys, int& numCenterlines, AcGeEntity3d**& paCenterlines)
This function gets the recorded custom AHL settings for the given object in the given view.
Input
Registered ID for the (external) application that is controlling the AHL settings. A pointer to a key to the view in question. A pointer to the object in question. The object is a model-space object associated with the view (i.e. it is part of the view "content"). A NULL pointer can be used to obtain any custom AHL settings that apply to the view in general, and not to any particular object in the view. True if the custom geometry participates in sectioning (if the view is sectioned). The length of the paGeomKeys array. An array of pointers to geometry keys to the custom geometry. The length of the paCenterlines array. An array of geometry for custom centerlines to be associated with the replacement geometry in the paGeomKeys argument.
Output
AmiStatus amiSetCustomAHL
(AmiAppId appId, AmiDwVwKey* pDwVwKey, AmiObjectKey* pObjKey, Adesk::Boolean bSectioning, int numGeoms, AmiGeomKey** paGeomKeys, int numCenterlines, AcGeEntity3d** paCenterlines)
This function records custom AHL settings for the given object in the given view. Since DetailViews use the same graphics as the parent view, AHL settings cannot be customized for DetailViews independently of the parent; keys to Detail-Views are rejected as input to this function. Any custom centerlines geometry should be in model WCS.
Input
appId pDwVwKey
Registered ID for the (external) application that is controlling the AHL settings. A pointer to a key to the view in question.
05/12/2001 Page 195
pObjKey
A pointer to the object in question. The object is a model-space object associated with the view (i.e. it is part of the view "content"). A NULL pointer can be used if the AHL settings apply to the view in general, and not to any particular object in the view. If the view is a sectioned view and if this argument is true, then the custom geometry will participate in the sectioning. The length of the paGeomKeys array. An array of pointers to geometry keys. The length of the paCenterlines array. An array of pointers to centerline geometry. It is expected that the centerline geometry will consist of AcGeLineSeg3d and AcGeCircArc3d (for bullseyes). Limitations: The custom geometry must be 2D. The custom geometry must be database-resident. The custom geometry must be in model-space.
Layouts
AmiStatus amiGetAllDwLayouts
Returns a layout key for each active layout, along with the size of the array.
Input
appName
Output
Optional. Application name for delegation. The size of the array. Array of pointers to keys for all the active layouts.
numKeys pKeys
Browser Display
The following functions allow you to determine whether the browser is currently being displayed, and to turn display of the browser on or off.
AmiStatus amiIsBrowserDisplayed ( Adesk::Boolean& fDisplay, const char* appName = MApiSys )
Returns a boolean stating whether or not the Mechanical Desktop browser is currently displayed.
Input
appName
Output
Application to perform this action. If true the browser is on; if false, it is not.
fDisplay
fDisplay appName
If true turn on the browser. If false, turn it off. Application to perform this action.
Browser Customization
The following two functions allow an application to add or remove additional tabs to the Mechanical Desktop browser. By adding custom tabs to the browser, applications can integrate many of their user interface functions with those of the Desktop. As the browser has become the dominant way in which many users interface with the Desktop, adding custom tabs has become increasingly desirable for developers.
AmiStatus amiAddBrowserTab ( const char* pTabTitle, CWnd* pPageWnd, AmiTabPageDisplay pageDisp, AcApDocument* pdoc = NULL, const char* appName = MApiSys )
Title string to be displayed on the tab. Handle to window that will be visible within the tab page. This window will be reparented and subclassed when this call is made. Specified when this page should be displayed. Document for which tab is to appear. If this parameter is NULL, the current document is used. Application to perform this action.
AmiStatus amiRemoveBrowserTab ( CWnd* pPageWnd, AcApDocument* pdoc = NULL, const char* appName = MApiSys )
Handle to window whose corresponding tab is to be removed from the browser. Document for which tab is to appear. If this parameter is NULL, the current document is used. Application to perform this action.
This function adds the file described by pFileToAttach as a dependent file. All PDM information is retrieved from the descriptor. The file descriptor must be managed (keyword kAttManaged is true).
Input
pFileToAttach
Creates an empty file descriptor, with all attributes set to NAV. It is the callers responsibility to free the descriptor.
Extracts an attribute value from the given file descriptor. Returns a code indicating whether the value was successfully retrieved from the descriptor. May return eNAV, indicating there is no value currently set on that attribute. This function is overloaded for all return types needed to support the current set of file attributes. These types are: Double Adesk::Boolean Int char* AmiSectionStructure AmiVersionConfig AmiDrivingData AmiFileType It is the caller's responsibility to free, as appropriate, any returned value.
Input
pFileDescrip Keyword
Output
Pointer to the file descriptor to query Enumerator indicating attribute value to query The current value of the specified attribute, appropriately typed
value
This function updates the file descriptor with the current path for the file described in pFileToUpdate. An error is returned if no corresponding file is registered.
Input
This function indicates whether a PDM system has registered to handle file management functions.
Output
isRegistered
This function removes the file described by pFileToRemove as a dependent file. The correct attachment is determined by the information on the descriptor, including the owner id, and group name.
Input
AmiStatus amiSetData
( AmiFileDescrip* pFileDescrip, AmiFileAttribute keyword, <type> char* value ) Set an attribute value on the given file descriptor. Returns a value that indicates whether the value was successfully applied to the descriptor. This function is overloaded for all return types needed to support the current set of file attributes. These types are: Double Adesk::Boolean Int char* AmiSectionStructure AmiVersionConfig AmiDrivingData AmiFileType
Input
Pointer to the file descriptor to modify Enumerator indicating attribute value to modify The new value of the specified attribute, appropriately typed
Attribute Accessors
File Descriptor attributes are all accessed using two functions amiSetData and amiGetData. The key word enumerator specifies which attribute is to be accessed. The following table enumerates the key words available and provides the supported data types.
AmiVersionConfig AmiDrivingData AmiSectionStructure const char * const char * const char * const char *
If an API call is made with a descriptor type and attribute type combination that is not listed in the above tables, then an error status is returned and no action is taken (the error status is eNotApplicable, or in some cases, eAttTypeMismatch).
Managed
kAttProperties
Mandatory
Versioning Globals
kAttHasInfoFor kAttVersionDir
optional mandatory
kAttStructure
kAttVersionDir
kAttFeatSheet
kAttFeatCell kAttParamSheet
kAttParamCell
Any string
If and only if has separate feature data Same as sheet If and only if has parameter data Same as sheet
Specifies the upper left corner cell of the feature suppression table The sheet name of the parameter section
If a descriptor with an invalid combination of attributes is applied to a table link, the error eInvalidDescriptor is returned.
= = =
The Sample Application is loaded manually using the ARX load command in Mechanical Desktop. The file maisamp.arx is located in the \SDK\mcadapi\sample\maisamp directory. All of the Sample Applications commands are available while the maisamp.arx is loaded and are accessed by typing at the command line. Notice that all of the Sample Application commands are prefixed with mai. In almost every case, sample application function names are identical to the MCAD API functions they exercises, except that the sample functions prefix is mai instead of ami. For example, in the sample code below the command maiCreateKey exercises the function amiCreateKey. The following example uses the Sample Application to create a key to an AutoCAD line, highlight the key and query the key for its type, copy the key and verify that the copy is the same as the original, and finally erase the object to which the key points and verify that it is erased. Command: line Specify first point: <select> Specify next point or [Undo]: <select> Specify next point or [Undo]: <enter> Command: maiCreateKey Key Type(ARc/AUgmented/CONE/CUrve/CYlinder/Ellipse/Geom/Line/PLane/ POInt/POLyline/SPHere/SPLIne/SPLSurf/SUrf/Torus/Vector/COMp/ Body/ SOlid/PArt/Feat/sKetch/SCene/Dwgview/ dwgANnotation <Object> ): line Restrict the picking to the currently active part instance? Yes/<No>: no Select object: [Last]: <select> Saving key of type: AmiLineKey Enter name to store (<None>/End): linekey "LINEKEY" added to the MAI_SAMPLE_KEY_DICT dictionary. Command: maiHighlight Enter key name: linekey MAI_SAMPLE_KEY_DICT Object found in document 1. Hit enter to continue... <enter> Command: maiGetKeyType Enter key name: linekey MAI_SAMPLE_KEY_DICT Object found in document 1. Key type = 4 Command: maiCopyKey Enter key name to copy: linekey MAI_SAMPLE_KEY_DICT Object found in document 1. 1. Drawing1.dwg
05/12/2001 Page 203
Which document should this command execute in: 1 Saving key of type: AmiLineKey Enter name to store (<None>/End): linekey2 "LINEKEY2" added to the MAI_SAMPLE_KEY_DICT dictionary. Command: maiAreKeysEquivalent Enter name of first object key: linekey MAI_SAMPLE_KEY_DICT Object found in document 1. Enter name of second object key: linekey2 MAI_SAMPLE_KEY_DICT Object found in document 1. The keys are equal. Command: maiEraseObject Enter object key name: linekey MAI_SAMPLE_KEY_DICT Object found in document 1. Command: maiObjectWasErased Enter key name: linekey MAI_SAMPLE_KEY_DICT Object found in document 1. The object is erased.
Common
Handling Pick Objects
MAIALLOWGHOST
Exercises: (see MAICREATEKEY and MAIFILLPICKOBJ) Use this command to set the allowGhost variable used for the amiPick() and amiFillPickObj() functions. The default is false.
MAICREATEKEY
Exercises: amiPick, amiGetKeyFromPick, amiGetGeomKey This command creates a key where a pick with amiPick() must be made. The user is prompted for the key type to create. See also: MAIALLOWGHOST.
MAIFILLPICKOBJ
Exercises: amiFillPickObj, amiGetKeyFromPick This command prompts the user to select entities and then attempts to create a key for each of those entities. This command demonstrates how to effectively use acedSSGet() and acedSSNameX() with the MCAD API. See also: MAIALLOWGHOST.
Creating Keys
MAIGETKEYFROMID
Exercises: amiGetKeyFromId Keys are created via this command from AcDbObjectIds, which are database ids that users can get from an ads_name or from ObjectARX. This command uses acedEntSel() to prompt the user for a single entity selection and attempts to create a key from the corresponding AcDbObjectId.
MAIGETKEYFROMPATH
Exercises: amiGetKeyFromPath This command attempts to create a key from an AcDbFullSubentPath. The user is prompted for an entity selection and will find an AcDbFullSubEntPath in case the object is either blocked or nested.
Creating Keys
MAICREATEINFERKEY
Exercises: amiPick, amiGetKeyFromPick, amiGetGeomKey This command creates an inferred geometry key where two (2) picks with amiPick() must be made.
Handling Keys
MAIAREKEYSEQUIVALENT
Exercises: amiAreKeysEquivalent This command prompts the user for two keys to check for equivalence. The result is displayed.
MAICOPYKEY
Exercises: amiCopyKey The user is prompted for a key name, and a key copy is created and may be stored in the database. A key copy is a key that refers to the same object as the original key.
MAIGETKEYTYPE
Exercises: amiGetKeyType This command prompts the user for a key name, gives the keys type, and displays the result on the screen.
MAIERASEOBJECT
Exercises: amiEraseObject This command prompts the user for a key name. The command then attempts to erase the geometry that the key refers to.
MAIISKEYKINDOF
Exercises: amiIsKeyKindOf This command prompts the user for a key name, compares that key against all key types in the key hierarchy, and displays the results on the screen.
MAIISKEYNULL
Exercises: amiIsKeyNull The intent of this command is to instantiate each type of key and, since nothing is done with the key variable to fill it up, will check to see if it is NULL. Since all of these keys will be NULL, a message displays on the screen stating that, for each key type, the key is NULL.
05/12/2001 Page 205
MAIREFOCUSKEY
Exercises: amiRefocusKey This command prompts the user for an object key name. The command then will refocus this key to the next key given (component key or part key). For example, the user may refocus a geometry key from one component instance to another.
MAIREFOCUSKEY2
Exercises: amiRefocusKey This command prompts the user for a key to refocus and a key to use as a reference. The key to refocus is then refocused to the scope of the reference.
Entity Highlighting
MAIHIGHLIGHT
Handling Geometry
MAICREATESURFFROMGEOM
Exercises: amiCreateSurfFromGeom This command creates a simple surface from hard-coded data.
MAICREATESURFARRAYFROMGEOM
Exercises: amiCreateSurfArrayFromGeom This command creates a untrimmed surface from the selected NURBS surface.
MAIGETSKETCHEDSPLINESEGMENTS
Exercises: amiGetSketchedSplineSegments This command prompts the user for key to a sketch spline. This command then returns geometry keys to the spline line segments of the given sketch spline.
MAIISDIRECTLYEDITABLE
Exercises: amiIsDirectlyEditable This command prompts the user for a key name (a geometry key). The command then checks to see if the geometry that the key refers to may be edited directly (for example, an edge of a Desktop part may not be edited directly).
MAISETGEOMETRY
Exercises: amiSetGeometry This command prompts the user for a geometry key name. The command then performs some hardcoded transformations on the entity if the entity can be edited directly.
Exercises: amiDisableActiveNotification
This command prompts the user for a geometry key name for which to disable active notification.
MAIENABLEACTIVENOTIFICATION
Exercises: amiEnableActiveNotification This command prompts the user for a geometry key name for which to enable active notification. When the object is changed, a message displays on the screen stating that the object has been changed. When the object is deleted, a message is also displayed.
MAIENABLEACTIVENOTIFICATION2
Exercises: amiEnableActiveNotification2 This command prompts the user for a geometry key name and to select an entity for which the id will be passed into the changed/erased functions. When the object is changed, a message is displayed, and the entity represented by the id passed to the change function is highlighted. When the object is deleted, a message is also displayed, and the entity represented by the id passed to the erased function is deleted.
MAIOBJECTHASCHANGED
Exercises: amiObjectHasChanged (see also MAIRESETNOTIFICATION) This command prompts the user for a geometry key name and checks to see if the object referred to by that key has changed since it was last checked. See also: MAIRESETNOTIFICATION.
MAIOBJECTWASERASED
Exercises: amiObjectWasErased This command prompts the user for a geometry key and then checks to see if the object referred to by that key has been erased. The results are displayed on the screen.
MAIRESETNOTIFICATION
Exercises: (see MAIOBJECTHASCHANGED) Use this command to set the resetNotification variable used for the amiHasObjectChanged() function. The default is true.
Exercises: amiGetBrepFromKey, amiGetKeyFromBrep Use this command to traverse a topological body. The user will have the opportunity to store each object for which a key can be created.
MAIBREPFROMTO
Exercises: amiGetBrepFromKey, amiGetKeyFromBrep This command prompts the user for an object key name. The command then will perform a direct test of amiGetBrepFromKey() and amiGetKeyFromBrep().
Handling Attributes
MAIADDATTRIBUTE
Exercises: amiAddAttribute This command prompts the user for an attribute name and an object key name to attach the attribute to. The command then attempts to attach the given attribute to the given object through the given object key.
MAIATTEDITFLAG
This command sets a value that determines if the user will have the opportunity to edit attributes that are returned during the MAIGETATTRIBUTES command.
MAIATTRASSOCTYPE
This command allows the user to set the type of attribute associativity that is used with amiAddAttribute(). Use this command to set the attribute associativity behaviour before using MAICREATEATTRIBUTE and MAIMAKEINSTATT.
MAICREATEATTRIBUTE
Exercises: (see MAIADDATTRIBUTE) This command creates an instance of the MAISAMPLEATTRIBUTE object and prompts the user for integer data the attribute contains.
MAIGETALLATTRIBUTES
Exercises: amiGetAllAttributes This command returns all of the attributes (of a given type) on the given object.
MAIGETATTRIBUTEHOLDERS
Exercises: amiGetAttributeHolders This command prompts the user for an attribute name and then returns all of the keys to the objects to which the supplied attribute has been attached.
MAIGETATTRIBUTES
Exercises: amiGetAttributes This command prompts the user for an object key name and returns all of the attributes that have been attached to the object identified by the key. The attributes are returned according to the MAILISTINDEX flag. The user will have the option to edit the data as per the flag set by MAIATTEDITFLAG. (See also MAILISTINDEX, MAIATTEDITFLAG.)
MAIHOLDERSFLAG
This command sets a value that determines if MAIGETATTRIBUTES will return the attribute holders or not while cycling through all of the attributes.
MAILISTINDEX
This command sets a value that determines how fields are looked up during the use of amiGetAttributes. When set to ON (Adesk::kTrue), attribute fields are retrieved with the amiGetFieldxxxI functions. Otherwise, fields are retrieved by name. The end result is transparent to the user. (See also MAIGETATTRIBUTES.)
MAIREMOVEATTRIBUTE
Exercises: amiRemoveAttribute This command prompts the user for an attribute name and an object key name to identify an object from which to remove the previously supplied attribute.
MAIOWNERISMCADAPI
Exercises: (see MAICREATEATTRIBUTE) This command prompts the user to set the ownerIsMCADAPI flag for the MAISAMPLEATTRIBUTE class derived from AmiAttribute. The default is false.
05/12/2001 Page 208
Instantiable Attributes
MAIDEFINEATTCLASS
Exercises: amiDefineAttClass This command prompts the user for an instantiable attribute class name to define. The command then prompts the user for attribute definition information such as the number of fields, field name(s), field description(s), and field type(s).
MAIGETATTCLASSES
Exercises: amiGetAttClasses This command lists all of the instantiable attribute classes that are currently defined.
MAIGETATTCLASSFIELDS
Exercises: amiGetAttClassFields This command prompts the user for an instantiable attribute class name and then prints out the information that defines the class: field names, descriptions and types.
MAIMAKEINSTATT
Exercises: amiMakeInstAtt This command prompts the user for a key to an object to which to attach a new attribute, and then prompts the user for an attribute class to be used. The user is then requested to enter required data for this instance of the attribute class. The attribute instance is then attached to the specified object.
MAIREADATTCLASSESFROMFILE
Exercises: amiReadAttClassesFromFile This command prompts the user for a file from which to acquire instantiable attribute class definitions and then defines these classes.
MAISTATICFLAG
Exercises: (see MAIDEFINEATTCLASS) This command prompts the user to turn on or off the static flag for new instantiable attribute class definitions. This command can be invoked transparently by prefixing it with a single quote. It will normally be called inside MAIDEFINEATTCLASS. Follow commands to specify which fields are static. The default is false.
MAIUNDEFINEATTCLASS
Exercises: amiUndefineAttClass This command prompts the user for an instantiable class name and then undefines the class if it is not currently used.
MAIWRITEATTCLASSTOFILE
Exercises: amiWriteAttClassToFile This command prompts the user for an instantiable class name and file name for which to write the attribute class definition to.
MAIWRITEATTCLASSESTOFILE
Exercises: amiWriteAttClassesToFile This command prompts the user for a file name and then writes all defined instantiable classes to that file.
Miscellaneous
MAIENDEXTERNALEDIT
Exercises: amiEndExternalEdit This commands prompts user if he wants to save changes before ending the XRef edit in progress.
MAIGETCURRENTDATABASE
Exercises: amiGetCurrentDatabase
Exercises: amiGetDbIdsFromKey This command prompts the user for an object key name. The command then attempts to find the AcDbObjectIds that the key refers to and displays the results on the screen.
MAIGETKEYFROMNAME
Exercises: amiGetKeyFromName This command prompts the user for the type of key and scope of the key to be returned. The command returns a new key to the project.
MAIGETOBJECTSTATE
Exercises: amiGetObjectState This command prompts the user for an object to query. The command returns the state of the given object.
MAIGETDESIGNMODE
Exercises: amiGetDesignMode This command returns information about the current modeling/drawing state.
MAISTARTEXTERNALEDIT
Exercises: amiStartExternalEdit This command starts an XRef edit on the given leaf node component for an external part.
Parametric Modeling
Parameter Handling
MAICREATEPARAM
Exercises: amiCreateParam This command allow the user to create a global or part parameter.
MAIEVALPARAMEXPRESS
Exercises: amiEvalParamExpress This command evaluates the validity of a global or local parameter expression.
MAIGETGLOBALPARAMS
Exercises: amiGetGlobalParams This command iterates through each global parameter in the drawing database and displays data associated with the parameter, such as name, expression, and value.
MAIGETPARAMDEPS
Exercises: amiGetParamDeps This command prompts the user for a parameter key name. The command then displays all of the parameter keys that affect the parameter key given.
MAIGETPARAMCOMMENT
Exercises: amiGetParamExpress This command prompts the user for a parameter key name. The command then displays the parameters current expression (formula, if any).
MAIGETPARAMNAME
Exercises: amiGetParamName This command prompts the user for a parameter key name. The command then displays the parameters name.
MAIGETPARAMUSERS
Exercise: amiGetParamUsers This command prompts the user for a parameter key name. The command then displays all of the parameter keys that are affected by the parameter key given.
MAIGETPARAMVALUE
Exercises: amiGetParamValue This command prompts the user for a parameter key name. The command then displays the parameters current value.
MAISETPARAMCOMMENT
Exercises: amiGetParamComment
05/12/2001 Page 211
Sets the comment of the parameter key given with the expression given.
MAISETPARAMEXPRESS
Exercises: amiSetParamExpress This command prompts the user for a parameter key name. The command then displays the parameters current expression and prompts the user for a new expression to set that parameter to.
MAISETPARAMVALUE
Exercises: amiSetParamValue This command prompts the user for a parameter key name. The command then displays the parameters current value and prompts the user for a new expression to which to set the parameter.
Part Handling
MAICREATEEMPTYPART
Exercises: amiCreateEmptyPart This command prompts the user for a name for the part to be created. Then a new part is created with that name.
MAIGETACTIVEPART
Exercises: amiGetActivePart This command returns a part key to the user that refers to the active part, if any.
MAIGETCONTAININGPART
Exercises: amiGetContainingPart This command prompts the user for a key name. The command then attempts to find the part that owns the object referred to by that key (the part given a key to a workplane, for example).
MAIGETMASSPROPS
Exercises: amiGetMassProps This command prompts users to enter key names at the command prompt until they press ENTER to end the prompting. The command then performs a mass properties calculation on all of the object keys supplied and displays some of the related data on the screen.
MAIGETNUMPARTFEATS
Exercises: amiGetNumPartFeats This command prompts the user for a part key name. The command then returns the number of features that the part contains.
MAIGETPARTFEATS
Exercise: amiGetPartFeats This command prompts the user for a part key name. The command then returns, one by one, each feature that the part contains.
MAIGETPARTPARAMS
Exercises: amiGetPartParams This command prompts the user for a part key name. The command then iterates through each local part parameter, displays some associated data, and grants the option to save the key(s).
MAIGETUNUSEDSKETCHESFROMPART
Exercises: amiGetUnusedSketchesFromPart This command prompts the user for a part key name. The command then returns all of the unused sketches for the part.
Regeneration Control
MAIREGEN
Exercises: amiRegen This command prompts the user for a key. Then the command updates that geometry.
MAISETNEEDSREGEN
Exercises: amiSetNeedsRegen This command prompts the user for an object key and then marks that object as needing a regeneration.
Suppression Control
MAISUPPRESSFEAT
Exercises: amiSuppressFeat This command prompts the user for a feature key name. The command then suppresses the feature and all features that depend on that feature. NOTE: In a suppressed state, some operations, such as AMEDITFEAT, cannot be performed.
MAISUPPRESSFEATSBYTYPE
Exercises: amiSuppressFeatsByType This command suppresses all features (of a given type) on the given part.
MAIUNSUPPRESSFEAT
Exercises: amiUnsuppressFeat This command prompts the user for a feature key name. The command then unsuppresses the feature and all features that depend on that feature.
MAIUNSUPPRESSFEATSBYTYPE
Exercises: amiUnsuppressFeatsByType This command unsuppresses all features (of a given type) on the given part.
MAIUNSUPPRESSPARTFEATS
Exercises: amiUnsuppressPartFeats This command unsuppresses all features on the given part.
Exercises: amiAddCompToCompDef This command prompts the user for two component definition key names and adds the second definition to the first.
MAICOPYCOMPDEF
Exercises: amiCopyCompDef This command prompts the user for a file name. If valid, the command then creates a component definition (external) and returns the resulting component definition key.
MAICREATECOMPDEFFROMFILE
Exercises: amiCreateCompDefFromFile This command prompts the user for a component definition key to be copied and a new component definition name. A component definition key to the new component definition is created, which may then be stored in the database.
MAIEXTERNALIZECOMP
Exercises: amiExternalize This command prompts the user for a component definition and a file name. Then the command externalizes the given definition.
MAIGETACTIVECOMPDEF
Exercises: amiGetActiveCompDef This command returns the component definition key that represents the current edit target.
MAIGETALLCOMPDEFS
Exercises: amiGetAllCompDefs This command iterates through all of the current drawings component definitions, displays their names, and returns the keys associated with those definitions along with the total number of component definitions.
MAIGETBODYFROMCOMPDEF
Exercises: amiGetBodyFromCompDef This command prompts the user for a component definition key name and then returns the leaf node body from that component definition.
MAIGETCOMPDEFCHILDREN
Exercise: amiGetCompDefChildren This command prompts the user for a component definition key name. The command then returns all of the definitions child component keys.
MAIGETCOMPDEFNAME
Exercises: amiGetCompDefName This command prompts the user for a component definition key name and returns the component definitions name.
MAIGETMASTERCOMPDEF
Exercises: amiGetMasterCompDef This command returns the component definition key that represents the current drawing databases master component definition, or the definition of the overall assembly.
MAIISCOMPDEFEXTERNAL
Exercises: amiIsCompDefExternal
This command prompts the user for a component definition key name. The command then checks to see whether or not that component definition is an external component definition and displays the result.
MAIISCOMPDEFLEAFNODE
Exercises: amiIsCompDefLeafNode This command prompts the user for a component definition key name and then checks to see if that component definition is a leaf node. The result is displayed on the screen.
MAIISCOMPDEFMASTER
Exercises: amiIsCompDefMaster This command prompts the user for a component definition key name and returns whether or not the component definition key given represents the current drawings master component definition.
MAILOCALIZECOMP
Exercises: amiLocalize This command prompts the user for a component definition. Then the command localizes the given definition.
MAIREMOVECOMPFROMCOMPDEF
Exercises: amiRemoveCompFromCompDef This command prompts the user for a component key name and a component definition key name from which to remove the previously supplied component key.
MAISETACTIVECOMPDEF
Exercises: amiSetActiveCompDef This command prompts the user for compDef key name and then sets the current edit target component to the referenced by the key entered.
MAISETCOMPDEFNAME
Exercises: amiSetCompDefName This command prompts the user for a component definition key name and a new component definition name. The command then sets the component definition name to the name supplied.
Component Handling
MAICREATECOMPDEF
Exercises: amiCreateCompDef This command prompts the user for a body key name and a component definition name. The command then creates a component definition per the name given and consumes the body given. The resulting component definition key is returned.
MAIGETACTIVELEAFNODE
Exercises: amiGetActiveLeafNode This command returns the active part component to the user.
MAIGETCOMPCHILDREN
Exercises: amiGetCompChildren This command prompts the user for a component key name. The command then displays and returns all of the keys to the components that are the children of the specified component.
05/12/2001 Page 215
MAIGETCOMPDEF
Exercises: amiGetCompDef This command prompts the user for a component key name and returns the key to that components definition.
MAIGETCOMPINDEF
Exercises: amiGetCompInDef This command prompts the user for a component key name and then returns the corresponding component key that lies within the components definition.
MAIGETCOMPNAME
Exercises: amiGetCompName This command prompts the user for a component key name. The command then displays the components name.
MAIGETCOMPOWNER
Exercises: amiGetCompOwner This command prompts the user for a component key name and returns a key to the definition of the component that owns the component passed in.
MAIGETCOMPPOSITION
Exercises: amiGetCompPosition This command prompts the user for a component key name. The command then displays the components position information.
MAIGETCONTAININGCOMP
Exercises: amiGetContainingComp This command prompts the user for a component key name. The command then attempts to find the component instance that owns the object referred to by that key (the component given a key to the work plane, for example).
MAIISCOMPTOOLBODY
Exercises: amiIsCompToolBody This command prompts the user for a component key to evaluate. Then the command returns whether or not the component is a tool body.
MAISETACTIVELEAFNODE
Exercises: amiSetActiveLeafNode This command prompts the user for key name. The command then sets the current edit target component to the referenced by the given key.
MAISETCOMPNAME
Exercises: amiSetCompName This command prompts the user for a component key name and a new component name. The command then changes the component specified by the given key to the new name supplied.
MAISETCOMPPOSITION
Exercises: amiSetCompPosition
This command prompts the user for a component key name to be changed and the component key name to set the position of the previously supplied component key to.
Constraint Handling
MAICREATEASSMCONSTR
Exercises: amiCreateConstraints This command allows the user to create multiple sketch constraints within a single command.
MAICREATEASSMCONSTR2
Exercises: amiCreateConstraints
This command allows the user to create multiple assembly constraints within a single command.
MAICREATESKETCHCONSTR2
Exercises: amiCreateConstraints This command creates assembly constraints defined by the user's input.
MAIGETCONSTRDESCRIPDATA
Exercises: amiGetConstrDescripData, amiGetData This command performs a full constraint query of the constraint key passed in.
MAIGETCONSTREXPR
Exercises: amiGetConstrExpr This command prompts the user for a constraint key name. The command then will print the expression associated with the key.
MAIGETCONSTRPARAM
Exercises: amiGetConstrParam This command prompts the user for a sketch constraint key name and then returns the parameter object associated with the constraint.
MAIGETCONSTRTYPE
Exercises: amiGetConstrType This command prompts the user for a constraint key name and returns the constraint type of that component constraint.
MAIGETCONSTRVALUE
Exercises: amiGetConstrValue This command prompts the user for a constraint key name. The command then displays the constraints value.
MAIGETCONSTROPERANDS
Exercises: amiGetConstrOperands This command prompts the user for a constraint key name. The command then returns the two geometry keys that are the operands of the given constraint.
MAIGETDIMCONSTRLOC
Exercises: amiGetDimConstrLoc This command prompts the user to enter the name of a constraint (sketch constraint) key that has a parametric dimension associated with it. The command then prints out the dimensions location.
05/12/2001 Page 217
MAISETCONSTREXPR
Exercises: amiSetConstrExpr This command prompts the user for a constraint key name. The command then will prompt the user for a new expression to set the constraint expression to.
MAISETCONSTRVALUE
Exercises: amiSetConstrValue This command prompts the user for a constraint key name and a new value. The command then sets the given constraints value to the new value given.
Exercises: amiGetCompsFromConstr This command prompts the user for a component constraint key and then returns the two components that use that constraint.
MAIGETCONSTRSACTINGONCOMP
Exercises: amiGetConstrsActingOnComp This command prompts the user for a component key name and then returns all of the component constraint keys that affect the positioning of the given component.
MAIGETCONSTRSFROMCOMP
Exercises: amiGetConstrsFromComp This command prompts the user for a component key name and returns the component constraint keys associated with that component.
Sketch Handling
MAICREATESKETCH
Exercises: amiCreateSketch This command prompts the user for the geometry to be used in the sketch and the type of sketch to create. The command then creates a sketch.
MAIGETCURRENTSKETCHPLANE
Exercises: amiGetCurrentSketchPlane This command returns a key to the active sketch plane.
MAIGETEXTSKETCHCONSTRS
Exercises: amiGetExtSketchConstrs This command prompts the user for a sketch key name and then returns all of the constraints that act upon the geometry in the sketch and geometry not in the sketch.
MAIGETFEATSFROMSKETCH
Exercises: amiGetFeatsFromSketch Returns the feature keys that use the same sketch key given.
MAIGETSKETCHCONSTRS
Exercises: amiGetSketchConstrs
05/12/2001 Page 218
This command prompts the user for a sketch key name and then returns all of the constraints that act upon the geometry in the sketch.
MAIGETPATHSTARTPOINT
Exercises: amiGetPathStartPoint This command prompts the user for a sketch key and returns a key to the start point.
MAIGETSKETCHCOORDSYS
Exercises: amiGetSketchCoordSys This command prompts the user to enter the name of a sketch key. The command then prints out the sketchs coordinate system, in terms of an AcGeMatrix3d.
MAIGETSKETCHDEFPLANE
Exercises: amiGetSketchDefPlane This command prompts the user for a sketch key and returns a geometry key to the plane the profile is on.
MAIGETSKETCHESFROMGEOM
Exercises: amiGetSketchesFromGeom Returns the sketch keys that share the same piece of geometry key given.
MAIGETSKETCHGEOM
Exercises: amiGetSketchGeom This command prompts the user for a sketch key name and then returns all of the geometry that makes up the sketch.
MAIGETSKETCHPARAMS
Exercises: amiGetSketchParams This command prompts the user for a sketch key name and then returns all of the parameter objects that act upon the sketch.
MAIGETSKETCHPLANE
Exercises: amiCreateFeatDescrip, amiCreateLocator, amiCreateAtomLocator, amiSetAtomLocData, amiAddAtomLocator, amiSetAtomLocData, amiSetAbsoluteLocData This command prompts the user for a line key, plane key, and orientation of sketch plane. The command then creates a sketch plane.
MAIGETSKETCHPLANEDESCRIPDATA
Exercises: amiGetSketchPlaneDescrip, amiGetFeatData, amiGetDescripType, amiGetLocator, amiGetAtomLocators, amiGetAtomLocType, amiGetAtomLocData, amiGetDistFromLocData, amiGetOnPlaneLocData, amiGetAbsoluteLocData, amiGetAngledLocData, amiGetOffsetLocData, amiGetCoordSysLocData This command prompts the user for a key to a sketch plane. Then the command dumps the descriptor information to the command line.
MAIGETSKETCHPLANEFROMSKETCH
Exercises: amiGetPlaneFromSketch This command prompts the user for a sketch key and returns the sketch plane from the sketch.
Exercises: amiCreateConstraint This command prompts the user for the type of constraint, and the key(s) to use to create the constraint.
MAIGETCONSTRSKETCHES
Exercises: amiGetConstrSketches This command prompts the user for a constraint key name. The command then will return the sketches which are constrained by the specified sketch constraint key.
Feature Handling
MAIGETFEATDESCRIPDATA
Exercises: All of the feature function calls as found in MIFEAT.H (also see MAIRETURNINFORMERS and MAIRETURNPARAMETERS) This command performs a full feature query of the feature key passed in.
MAIGETFEATDEPFEATS
Exercises: amiGetFeatDepFeats This command prompts the user for the state of the features to return. The command then returns all of the features(in the given state) which are dependent on the given feature.
MAIGETFEATDEPWORKGEOM
Exercises: amiGetFeatDepWorkGeom This command returns all of the work entities dependent on the given feature.
MAIGETFEATEDGES
Exercises: amiGetFeatEdges This command prompts the user for a feature key name. The command then returns to the user all of the curve keys which represent that feature.
MAIGETFEATFACES
Exercises: amiGetFeatFaces This command prompts the user for a feature key name. The command then returns to the user all of the surface keys which represent that feature.
MAIGETFEATPARAMS
Exercises: amiGetFeatParams This command prompts the user for a feature key name. The command then iterates through all of the feature keys associated parameters.
MAIGETFEATSFROMGEOM
Exercises: amiGetFeatsFromGeom This command prompts the user for a geometry key name and then returns all of the features (if any) that share that piece of geometry.
MAIGETFEATSKETCH
Exercises: amiGetFeatSketch
This command prompts the user for a feature key name and then returns the sketch key associated with the feature (if one exists).
MAIGETFEATTYPE
Exercises: amiGetFeatType This command returns the type of feature key passed in.
MAIGETFEATVERTICES
Exercises: amiGetFeatVertices This command prompts the user for a feature key name. The command then returns to the user all of the point keys which represent that feature.
MAIISFEATKINDOF
Exercises: amiIsFeatKindOf This command returns the feature type of the given feature.
MAIREORDERFEAT
Exercises: amiReorderFeat This command prompts the user for two feature keys. The command then reorders the first key immediately before the second key in the history tree.
MAIRETURNFEATKEY
Exercises: (also see MAIGETFEATDESCRIPDATA) This command set the fReturnInformers flag as used by amiGetFeatDescrip().
MAIRETURNINFORMERS
This command sets the fReturnFeatKey boolean parameter used with amiCreateFeature(). See also MAIFILLET, MAICHAMFER.
MAIRETURNPARAMETERS
Exercises: (also see MAIGETFEATDESCRIPDATA) This command set the fReturnParameters flag as used by amiGetFeatDescrip().
MAISKETCHPLANE
Exercises: amiGetPickInfo, amiCreateFeatDescrip, amiCreateLocator, amiCreateAtomLocator, amiSetAtomLocData, amiSetCoordSysLocData, amiAddAtomLocator, amiCreateAtomLocator, amiSetAbsoluteLocData, amiSetLocator, amiCreateSketchPlane This command prompts the user for the properties of the sketch plane to create. The command then creates the sketch plane.
Exercises: amiCreateFeatDescrip, amiSetArrayFeature, amiCreateLocator, amiCreateAtomLocator, amiAddAtomLocator, amiSetAtomLocData, amiSetRecArrayRowData, amiSetRecArrayColData, amiCreateAtomLocator, amiCreateAtomLocator, amiAddAtomLocator, amiSetPolarArrayPolarAngleType, amiSetPolarArrayAngle, amiSetPolarArrayRotateAsCopied, amiSetPolarArrayNumInstances, amiSetLocator, amiCreateFeature This command prompts for user input of array properties. The command then creates an array feature.
05/12/2001 Page 221
MAIBASE
Exercises: amiCreateFeatDescrip, amiSetBaseData, amiCreateFeature This command creates a base feature given a solid key.
MAICHAMFER
Exercises: amiCreateFeatDescrip, amiSetChamferType, amiSetChamferDist1, amiSetChamferDist2, amiSetChamferAngle, amiSetChamferEdges, amiSetChamferAngleFace, amiCreateFeature This command creates a chamfer feature as per user input.
MAICOMBINE
Exercises: amiCreateFeatDescrip, amiSetCombinerType, amiSetParametricBoolComp, amiCreateFeature This command prompts for user input of combine properties. The command then creates an combine feature.
MAIEXTRUDE
Exercises: amiCreateFeatDescrip, amiCreateTerminator, amiSetExtrusionDraftAngle, amiSetCombinerType, amiSetExtrusionProfile, amiSetBlindTermData, amiSetMidPlaneTermData, amiSetToPlaneTermData, amiSetToFaceTermData, amiSetFromToTermData, amiSetTerminator, amiSetExtrusionDirectionVector, amiCreateFeature This command prompts for user input of extrusion properties. The command then creates an extrusion feature.
MAIFACEDRAFT
Exercises: amiCreateFeatDescrip, amiSetDraftPlane, amiSetDraftAngle, amiSetPlaneDraftFaces, amiSetShadowDraftFaces, amiSetEdgeDraftFaces, amiCreateFeature This command prompts the user for the type of facedraft feature to create. The command then creates a facedraft feature.
MAIFACESPLIT
Exercises: amiCreateFeatDescrip, amiSetFaceSplitFaces, amiCreateLocator, amiCreateAtomLocator, amiSetAtomLocData, amiAddAtomLocator, amiSetLocator, amiCreateFeature This command prompts the user to pick faces to split and an object to use as a split plane. Then the command creates the facesplit operation.
MAIFILLET
Exercises: amiCreateFeatDescrip, amiSetFilletEdges, amiSetUniFilletRadius, amiSetIndFilletRadii, amiSetFixedFilletChordLength, amiSetCubicFilletRadii, amiSetLinearFilletRadii, amiCreateFeature This command creates a fillet feature as per user input.
MAIGETPARTWORKAXES
Exercises: amiGetPartWorkAxes This command queries a given part and returns keys to all of the parts work axes.
MAIGETPARTWORKPLANES
Exercises: amiGetPartWorkPlanes This command queries a given part and returns keys to all of the parts work planes.
MAIGETPARTWORKVERTICES
Exercises: amiGetPartWorkVertices This command queries a given part and returns keys to all of the parts work points.
MAIHOLE
Exercises: amiCreateFeatDescrip, amiSetHoleTapData, amiSetHoleDiameter, amiSetHoleDrillAngle, amiSetCBoreHoleCbDepth, amiSetCBoreHoleCbDiam, amiSetCSinkHoleCsAngle, amiSetCSinkHoleCsDiam, amiSetHoleDirectionVec, amiSetBlindTermData, amiSetToPlaneTerm, amiSetToFaceTermData, amiCreateLocator, amiCreateAtomLocator, amiAddAtomLocator, amiSetLocator, amiSetAtomLocData, amiCreateTerminator, amiSetTerminator, amiCreateFeature This command prompts the user to define the type of hole to create and creates the defined hole.
MAILOFT
Exercises: amiGetKeyType, amiIsKeyKindOf, amiCreateFeatDescrip, amiSetCombinerType, amiSetLoftType, amiSetLoftWeights, amiSetLoftAngles, amiSetLoftXSections, amiCreateFeature This command prompts the user for the type of loft feature to create. The command then creates a loft feature.
MAIMODIFIER1
Exercises: amiCreateFeatDescrip, amiSetPartSplitFlip, amiSetPartSplitName, amiCreateLocator, amiCreateAtomLocator, amiSetAtomLocData, amiAddAtomLocator, amiSetLocator, amiCreateFeature This command prompts the user for an object to use as a split plane. Then the command splits the part on this plane.
MAIREVOLVE
Exercises: amiCreateFeatDescrip, amiCreateTerminator, amiSetCombinerType, amiSetRevolveDirectionVec, amiSetRevolveProfile, amiSetRevolveAxis, amiSetBlindTermData, amiSetMidPlaneTermData, amiSetToPlaneTermData, amiSetToFaceTermData, amiSetFromToTermData, amiSetTerminator, amiCreateFeature This command prompts for user input of revolve properties. The command then creates an revolve feature.
MAISHELL
Exercises: amiCreateFeatDescrip, amiCreateTerminator, amiSetCombinerType, amiSetMidPlaneTermData, amiSetInsideTermData, amiSetOutsideTermData, amiSetShellExcludes, amiSetShellOverrides, amiSetTerminator, amiCreateFeature This command prompts for user input of shell properties. The command then creates an shell feature.
MAISURFCUT
Exercises: amiCreateFeatDescrip, amiSetCombinerType, amiCreateLocator, amiCreateAtomLocator, amiSetAtomLocData, amiAddAtomLocator, amiSetLocator, amiSetSurfCutSurf, amiSetSurfCutDirectionVec, amiCreateTerminator, amiSetTerminator, amiCreateFeature
This command prompts for user input of surfcut properties. The command then creates an surfcut feature.
MAISWEEP
Exercises: amiCreateFeatDescrip, amiCreateTerminator, amiSetToFaceTermData, amiSetFromToTermData, amiSetTerminator, amiSetSweepProfile, amiSetSweepPath, amiSetSweepDraftAngle, amiSetCombinerType, amiCreateFeature This command prompts for user input of sweep properties. The command then creates an sweep feature.
MAIWORKAXIS
Exercises: amiCreateFeatDescrip, amiCreateLocator, amiCreateAtomLocator, amiAddAtomLocator, amiSetLocator, amiCreateConstrGeom, amiSetAtomLocData This command prompts the user for a surface key name. The command then creates a workaxis.
MAIWORKPLANE
Exercises: amiCreateFeatDescrip, amiCreateLocator, amiCreateAtomLocator, amiAddAtomLocator, amiSetLocator, amiSetAtomLocData, amiCreateConstrGeom This command prompts the user for the method of workplane creation. The command then prompts the user to enter the name of keys to use for the creation of the workplane. The command then creates a workplane.
MAIWORKPOINT
Exercises: amiCreateFeatDescrip, amiCreateLocator, amiCreateAtomLocator, amiAddAtomLocator, amiSetOnPlaneLocData, amiSetLocator, amiCreateConstrGeom This command creates a workpoint at a user-defined location.
Array Descriptors
MAIARRAYHASINDEPENDENTINSTANCES
Exercises: amiArrayHasIndependentInstances
This command prints out whether or not the array has any independent instances.
MAIISARRAYINSTANCEINDEPENDENT
Exercises: amiIsArrayInstanceIndependent This commands prompts user for row/column spec and prints out whether or not the instance at that location is independent or not.
Table-Driven Versions
MAICREATELINK
Exercises: amiCreateFileDescrip, amiSetLink, amiSetData This command creates a link to the given object in the current drawing.
MAIGETCURRENTVERSION
Exercises: amiGetCurrentVersion This command queries the given object for the name of the current version.
MAIGETLINKDATA
Exercises: amiGetLinkInfo, amiGetData This command queries the given object for its attributes.
MAIREMOVELINK
Exercises: amiRemoveLink This command removes the link for the given object.
MAISETCURRENTVERSION
Exercises: amiSetCurrentVersion This command sets the current version of the given object.
MAISETLINKDATA
Exercises: amiGetLinkInfo, amiSetLink, amiSetData This command sets attributes on the given objects link.
Event Handling
MAIREGISTEREVENTREACTION
Exercises: amiRegisterApp, amiRegisterEventReaction This command prompts the user for the type of event. Then the command registers the event for notification.
MAIREMOVEEVENTREACTION
Exercises: amiRegisterApp, amiRemoveEventReaction This command prompts the user for the type of event to remove. The command then removes registered event callbacks for that event.
Miscellaneous
MAIGETDESIGNMODE
Exercises: amiGetDesignMode This command returns information about the current modeling/drawing state.
MAISETDESIGNMODE
Exercises: amiSetDesignMode This command prompts the user for a new design mode. Then the command sets the design mode to that specified.
Analysis
MAICHECKINTERFERENCE
Exercises: amiGetDOFDescrip, amiGetData, amiGetDataArray This command prompts the user for two component keys and returns interferences between the given components.
MAIGETDOFDESCRIPDATA
Exercises: amiGetDOFDescrip, amiGetData, amiGetDataArray This command prompts the user for an object key. Then the command dumps the descriptor information to the command line.
MAIMINDISTANCE
Exercises: amiMinDistance This command prompts the user for two component keys and returns minimum distance between the given components.
Drawing Manager
MAICREATEDWANNOT
Exercises: amiCreateDwAnnotDescrip, amiSetDwAnnotData, amiCreateDwAnnot, amiSetDwAnnotGeom This command prompts the user for the type of annotation and the attributes to set. The command then creates the drawing annotation.
MAICREATEDWVW
Exercises: amiCreateDwVwDescrip, amiSetDwVwData, amiCreateDwView This command prompts the user for the type of drawing view and the attributes to set. The command then creates the drawing view.
MAICREATEINFERGEOMKEY
Exercises: amiInferGeomKey This command prompts the user for an array of geometry keys and a proximity point. The command then returns an inferred geometry key.
MAIGETALLDWVWS
Exercises: amiGetAllDwVws This command returns keys to all of the drawing views.
MAIGETDWANNOTDATA
Exercises: amiGetDwAnnotDescrip This command prompts the user for an annotation key. Then the command returns the value of that annotation.
MAIGETDWVWANNOTS
Exercises: amiGetDwVwAnnots This command prompts the user for a drawing view key. Then the command returns all of that views annotations.
MAIGETDWANNOTVIEW
Exercises: amiGetDwAnnotView This command prompts the user for an annotation key. Then the command returns the view to which the annotation belongs.
MAIGETDWVWATTRIBUTE
Exercises: amiGetDwVwDescrip, amiGetData This command prompts the user for a drawing view key and the type of attribute to return. The command then returns all attributes of the given type.
MAIGETDWVWPARENT
Exercises: amiGetDwVwParent This prompts the user for a drawing view key and returns the parent view of that key. maiGetNumDwVws() Exercises: amiGetNumDwVws This command returns all of the drawing views in the current drawing.
MAIISDWANNOTKEYKINDOF
Exercises: amiGetDwAnnotDescrip, amiDwAnnotDescripIsKindof This command prompts the user for an annotation key. Then the command returns all of the key types which it derives from.
MAIISDWVWKEYKINDOF
Exercises: amiGetDwVwDescrip, amiDwVwDescripIsKindof This command prompts the user for a drawing view key. Then the command returns all of the key types which it derives from.
MAIMOVEDWANNOT
Exercises: amiMoveDwAnnot This command prompts the user for an annotation key name and displacement value. Then the command moves the annotation to the new location.
MAISETDWANNOTDATA
Exercises: amiCreateDwAnnotDescrip, amiSetDwAnnotData, amiDwEditAnnot This command prompts the user for an annotation key, the attribute to change, and the value to change it to. Then the command sets that attribute.
MAISETDWANNOTVIEW
Exercises: amiSetDwAnnotView This command sets the given annotations owning view.
MAISETDWVWATTRIBUTE
Exercises: amiCreateDwVwDescrip, amiSetData, amiDwEditView This command prompts the user for a drawing view key and type of attribute to set. The command then sets the chosen attribute with the user defined value.
Scenes
MAICREATESCENE
Exercises: amiCreateScene This command prompts the user for a component definition key and the name for the new scene. The command then creates a new scene with the given name.
MAIGETALLSCENES
Exercises: amiGetSceneLock This command prompts the user for a scene key and returns the current locking status of that scene.
MAISETSCENELOCK
Exercises: amiSetSceneLock This command prompts the user for a scene key and a locking status to set on that scene.
Exercises: amiClearCustomAhl This command prompts the user for a drawing view key name. Then it gives option of clearing the AHL settings of a view referenced by the key entered earlier or object (key to which needs to be entered) in that view.
MAICUSTOMAHLON
This command prompts the user for a drawing view key name. This function just turns on viewregen notification.
MAIGETCUSTOMAHL
Exercises: amiGetCustomAhl This command prompts for DwVwKey and the object key in that view. The command then displays recorded custom AHL settings for a given key in a given view. It displays whether custom geometry participates in AHL calculations or not. An array of pointers to geometry keys is also returned.
MAISETCUSTOMAHL
Exercises: amiSetCustomAhl The command prompts for DwVwKey, object key in that view, AHLflag to specify if the custom geometry participates in AHL calculation, length and array of pointers to geometry keys. This command then records custom AHL settings for the given object in the given view.
Layouts
MAIGETALLDWLAYOUTS
Exercises: amiGetAllDwLayouts The command returns a layout key for each active layout.
Exercises: amiIsBrowserDisplayed The command tells whether or not the Mechanical Desktop browser is currently displayed.
MAIDISPLAYBROWSER
Exercises: amiDisplayBrowser The command turns the display of Mechanical Desktop browser On or Off.
Exercises: amiIsPDMRegistered This command returns whether or not there is a PDM registered.
MAIREGISTERPDM
Exercises: amiCreateFileDescrip, amiSetData, amiAttachFile This command registers a file with a PDM using a sample app attribute.
MAIUNREGISTERPDM
Exercises: amiCreateFileDescrip, amiSetData, amiRemoveFile This command unregisters a file with a PDM using a sample app attribute.
Utility
MAIDELETEKEY
This command prompts the user for an object key name to delete from the named objects dictionary.
MAIDELETEATTRIBUTE
This command prompts the user for an attribute name to delete from the named objects dictionary.
MAIGETSYSVAR
Exercises: amiGetSysVar This command prompts the user for a AutoCAD system variable and then displays the value of that AutoCAD system variable.
MAILISTATTRIBUTES
This command lists the names of all of the attributes stored in the named objects dictionary.
MAILISTKEYS
This command lists the names of all of the keys stored in the named objects dictionary.
MAIPRINTATTRIBUTE
This command prompts the user for an attribute name. The command then displays data associated with the attribute given.
MAIPRINTKEY
This command prompts the user for an object key name. The command then displays data associated with the key given, depending on the key type.
MAIPRINTSTATUSINFO
This command switches fPrintStatusInfoFlag which is used in function printStatusInfo for printing the details of the status returned by all McadAPI functions.
MAIRESETATTRIBUTEDICT
This command removes all of the attributes stored in the named objects dictionary.
MAIRESETKEYDICT
This command removes all of the keys stored in the named objects dictionary.
MAISETSYSVAR
Exercises: amiSetSysVar This command prompts the user for a AutoCAD system Variable name and the value that needs to be assigned to it. This command then sets that value to the AutoCAD system variable that was entered.
Commands SHCreate
Prompt the user to select two edges of a part, and create a SmartHole feature in the center of the common face. This command demonstrates prompting sequences, various utility functions, hole and fillet feature creation, creation of key containing custom object, and instantiable attribute attachment.
SHEdit
Prompt the user to select a SmartHole feature, and edit the values for the hole diameter and fillet radius. This command demonstrates using attached attributes to control selection and in locating a custom object in a dictionary, as well as editing features through parameters.
SHErase
Prompt the user to select a SmartHole feature and erase it, removing the SmartHole object from the dictionary, and the features on the part. This command demonstrates erasing feature objects, and the proper handling of keys in custom objects during erase and destruction.
SHMatch
Prompt the user to select an assembly component, and if any SmartHole features on the selected component are involved in an 'insert' assembly constraint, allow the user to choose from which SmartHole the other will inherit the hole diameter and fillet radius values from. This command demonstrates accessing assembly constraints, and using the B-Rep API to traverse feature topology.
SHAudit
Iterate over the SmartHole dictionary, and update the SmartHole to the stored values. If the hole feature was erased, erase the SmartHole, otherwise regenerate the fillet to account for any non filleted hole /part intersecting edges. This command demonstrates locating and managing features from a custom object.
Known Issues
In order to erase features with amiEraseObject, the part containing the feature must be the active part. The SetActivePart() utility function is used for this, but only looks for a component instance to activate in the current target. Erasing a SmartHole feature with SHErase or regenerating the fillet on a SmartHole feature on a component that is not instanced into the
05/12/2001 Page 231
current edit target will fail to erase the features. Regenerating the SmartHole's fillets simply erases the existing fillet and recreates it. This means any assembly constraints or dependent features on the fillet will be invalidated by a call to SHAudit. The SmartHole object does not support or prevent manipulation in an externally attached file and wblockClone operations such as localize (xbind), externalize (wblock), and insert. The code is organized for readability by command, and therefore does not necessarily represent a good class design.
Known Issues
The command attempts to reset the active part to that of which was the active part before the command was started. However, if the active part before the command was started was a componentized part, this will not happen.
BREP API AcBrBrep::setSubentPath() AcBrBrepFaceTraverser::setBrep() AcBrBrepFaceTraverser::done() AcBrBrepFaceTraverser::next() AcBrBrepFaceTraverser::getFace() AcBrFace::getSurface() AcBrFace:: getPointRelationToFace() AcBrFaceLoopTraverser::setFace()
Files
PROJHOLE.DSP, PROJHOLE.DSW PROJREG.CPP PROJHOLE.CPP MS Visual C++ version 6 Service Pack 2 project files RX entry point and command definition Main source
MCAD API documentation MCAD API specific headers MCAD API proxy library Examples demonstrating the use of the MCAD API Sample application that counts assemblies General access to MCAD API Sample application that traverses B-rep topologies Browser sample application Hole projection sample application SmartHole sample application Locating MDT on end user machine sample application
BREP headers BREP and ACIS dependent geometry libraries Examples demonstrating the use of the BREP API
The lib directory contains the files mcadapi.lib and amdt_attributes.lib, which are the library file that users of the MCAD API need to link against and corresponds to the MCAD API. The sample directory contains examples of applications written on top of the MCAD API. = The maisamp directory contains the application that was used in the MCAD API testing. Also included is the executable file for the sample application maisamp.arx, the file defining the functions being exported by the application maisamp.def, and the Visual C++ 6.0 Service Pack 2 project file for the sample application. For more information on this sample application see Appendix A. = The smarthole directory contains the application that demonstrates using the instantiable attribute mechanism to associate features together to simulate an aggregate, or custom feature. In this directory are the following source files: smarthole.h smarthole.cpp entryPnt.cpp SHAudit.cpp SHCreate.cpp SHEdit.cpp SHErase.cpp SHMatch.cpp
Also included is the executable file for the sample application smarthole.arx, the file defining the functions being exported by the application smarthole.def, and the Visual C++ 6.0 Service Pack 2 project file for the sample application. For more information on this sample application, see Appendix A. = The projhole directory contains the application that is a hole projection application sample. In this directory are the following source files: projhole.cpp projreg.cpp
Also included is the executable file for the sample application projhole.arx, the file defining the functions being exported by the application projhole.def, and the Visual C++ 6.0 Service Pack 2 project file for the sample application. For more information on this sample application, see Appendix A. = The CountAssemblies directory contains the application that is an assembly counting application sample. For more information on this sample application, see Appendix A. = The MfcBrepTrav directory contains the application that is a B-rep traversal application sample. For more information on this sample application, see Appendix A. = = The MyBrowser directory contains a browser customization sample appication.. For more information on this sample application, see Appendix A. The Which_MDT directory contains a sample application that demonstrates how to locate an installation and version of MDT on an end users system. For more information on this sample application, see Appendix A.
Integer
(acedGetInt)
Real
(acedGetReal)
Distance
(acedGetDist or acedGetReal)
Angle
(acedGetString)
= RTSTR, 0.5, The value must be Radians if AUNITS is set to three or Decimal Degrees if AUNITS is set to zero.
Keyword
= = RTSTR, RTSTR,
(acedGetString)
thru
String
(acedGetString)
Section A-A
(acedGetPoint)
Single selection
= RTLB
(acedEntSel or acedNEntSelP)
05/12/2001 Page 242
: : : RTLE This list is the standard list containing the information returned from a call to entsel or nentselp. For more specific information on the information contained in this list, see your AutoCAD documentation. If you manually construct this list, you must include, at least, the entity name and the pick location. For example: RTLB RTENAME RTPOINT or RT3DPOINT RTLE For many of the Mechanical Desktop commands it might be necessary to use the point and re-select the entity to determine more specific information about what part of the entity was selected. If this reselection is necessary, the entity must be visible and the viewport the entity was originally selected in must be the currently active viewport. If not, the command will either fail or result in unexpected behavior. After youve finished providing single selections to a prompt that continues to loop and prompt you for another selection, use RTNONE, RTNIL or RTSTR and pass an empty string. (The AMFILLET command is an example of this.) The assembly modeling commands are frequently looking for selections of entities contained within blocks. Thus, use nentselp instead of entsel when providing a selection.
Notes
= When invoked through LISP, all of the Mechanical Desktop prompts will work with interactive prompting. To do this, provide the LISP prompt instead of the value. For example, instead of setting the sketch angle tolerance to a hardcoded value, it can be invoked through LISP so that it prompts you for the value. (amskangtol 4.5) This assigns the value 4.5 to amskangtol. (amskangtol (getreal)) This prompts you for the value to assign to amskangtol. When invoked through LISP or ads, all of the Mechanical Desktop prompts will work if a variable of the appropriate type is provided instead of a hardcoded value. For example, a value can be prompted for earlier in the program, assigned to a variable, the variable can be modified, if needed, and the variable can be used when invoking the Mechanical Desktop command. From LISP: : : (setq angTol (getreal)) : : // Modify angTol if necessary. : (amskangtol angTol) : : From Ads: : ads_real angTol; status = acedGetReal(Enter value:, &angTol); : : // Modify angTol if necessary. : struct resbuf *argList, *rslt; argList = acutBuildList(RTSTR, amskangtol, RTREAL, angTol, 0); status = acedInvoke(argList, &rslt);
From an ads program: struct resbuf *argList, *rslt; ads_point pt1, pt2, pt3; pt1[0] = 9.3; pt1[1] = 8.0; pt2[0] = 11.9; pt2[1] = 6.7; pt3[0] = -1.0; pt3[1] = -2.0;
argList = acutBuildList(RTSTR, "amhole", RTSTR, "drill", RTSTR, "thru", RTREAL, 0.5, RTSTR, "no", RTSTR, "twoEdges", RT3DPOINT, pt1, RT3DPOINT, pt2, RT3DPOINT, pt3, RTREAL, -2.0, RTREAL, -1.0, 0); status = acedInvoke(argList, &rslt);
System Variables
To get the value of a Mechanical Desktop system variable through LISP or ads, you need to invoke the system variable command without modifying its value. From LISP, the value of the Mechanical Desktop system variables can be obtained by invoking the system variable command and assigning the return value to the appropriate type. From an ads program, the value of the Mechanical Desktop system variables can be obtained from the result field of acedInvoke(). Below is a list of the system variables and the value types returned. At the end of this section are some examples. Mechanical Desktop Part Modeling
AMCOMPSV AMCONDSPSZ AMRULEMODE AMSKANGTOL AMSKMODE AMSKSTYLE RTSHORT RTSHORT RTSHORT RTREAL RTSHORT RTSTR
Drawing Manager
AMANNOTEPRESERVE AMCLCM AMCLGAP AMCLOSHT AMCLPAR AMCLTYPE AMDWGCOLOR AMHIDLTYPE AMHLCALC AMLINETHICK AMPROJTYPE AMREUSEDIM AMSECLTYPE AMSECTIONDIM AMSTDDTL AMSTDSCT AMSTDTAP RTSHORT RTREAL RTREAL RTREAL RTSHORT RTSTR RTSHORT RTSTR RTSHORT RTREAL RTSHORT RTSHORT RTSTR RTSHORT RTSTR RTSTR RTSTR
Assembly Modeler
AMAUTOASSEMBLE AMINSERTABS AMSCENEUPDATE AMVIEWRESTORE RTSHORT RTSHORT RTSHORT RTSHORT
Part Modeling
AMCMDDIM RTSHORT
Miscellaneous
ACISOUTVER RTSHORT
Getting the value of a system variable: From LISP: (setq vlines (amvlines "")) or (setq gap (amjoingap nil)) From ads: struct resbuf *arglist, *rslt; arglist = acutBuildList(RTSTR, RTSTR, 0);
amskangtol, ,
Example
An application might have the key of an edge that it wants to fillet. It can only create the fillet by calling the command AMFILLET. This command requires that a pickpoint be specified, identifying the edge to be filleted. When used interactively, the user can change the view and inspect the part to determine how to pick the required edge. This is much harder to achieve within an application. Depending on the view, other edges might be hiding the required edge; thus, it might be difficult, or even impossible, for the application to identify the edge to be filleted. The problem of integrating the MCAD API with the calling of commands has been solved. It is now possible to call the commands directly using the Keys generated within the MCAD API.
Benefits
The benefits of this enhancement are = = = = = Applications are more reliable. Applications can be developed immediately, rather than waiting for future versions of the MCAD API. Functionality accessible to developers using the MCAD API is dramatically improved. Applications are more efficient. Changes to the commands do not affect their use in any other way. If developers are not using the MCAD API, changes made are not visible. Any existing calls to commands continue to work unchanged. Certain operations can be performed using the commands. This allows the developers of the MCAD API to concentrate on those aspects for which there is no command alternative. This ensures that the MCAD API developers can best meet the needs of third-party developers.
Usage Details
Using the MCAD API, users can generate Keys to certain entities within Mechanical Desktop. For example, the application might have obtained the Key to an edge, represented as an AmiCurveKey. If a Desktop command requires an edge to be specified (e.g., positioning a hole from two edges through
05/12/2001 Page 247
AMHOLE), instead of trying to specify the edge to the command by getting the entity name and a point on the edge using the key and passing this information to the command, the Key can be passed directly to the command. The command would be called using acedInvoke, in the normal way. acedInvoke takes a resbuf chain, which can be constructed using acutBuildList. Here, instead of identifying the edge using RTLB, RTENAME, pName, RT3DPOINT, pickPt, RTLE, use the sequence RTLB, RTLONG, 0, RTLONG, (long) pKey, RTLE. As stated above, the first way of calling the command continues to be supported as well.
Sample Code
The attached sample code lets the user pick a face and then traverses through the edges of the face filleting all edges with the same radius. int facefillet() { // Command which lets the user pick a face, specify radius, and fillets all the edges of the // face with the provided fillet. AmiStatus amiEs; AmiPickObj pickObj; amiEs = amiPick("\nPlease select face to fillet\n", Ami::surfKey, NULL, pickObj); if( amiEs != Ami::eOk ) return AcRx::kRetError; AmiObjectKey *pKey = NULL; AmiKeyType keyType;
amiEs = amiGetKeyFromPick(&pickObj, keyType, pKey); if(amiEs != Ami::eOk) return AcRx::kRetError; AmiGeomKey* pGeomKey = AmiGeomKey::cast(pKey); if (pKey == NULL) { // This should never happen pKey->release(); return AcRx::kRetError; }
AcBrEntity* pBrEnt = NULL; amiEs = amiGetBrepFromKey(pGeomKey, pBrEnt); pKey->release(); AcBrFace* pFace = AcBrFace::cast(pBrEnt); if(pFace == NULL) { delete pBrEnt; return AcRx::kRetError; } if(amiEs != Ami::eOk) return AcRx::kRetError; double radius; if(RTNORM != acedGetReal("\nPlease enter radius of fillet\n", &radius)) { delete pFace; return AcRx::kRetError; } // now construct the calling list struct resbuf* pCallingRb = acutBuildList(RTSTR, "", RTREAL, radius, 0); // Some B-rep error handling omitted AcBr::ErrorStatus brEs; AcBrFaceLoopTraverser faLoTrav; brEs = faLoTrav.setFace(*pFace); if( brEs != AcBr::eOk ) { delete pFace; return AcRx::kRetError; } // keep the keys somewhere, so they can be released later. AcDbVoidPtrArray keyArray; for(;!faLoTrav.done(); faLoTrav.next()) { AcBrLoopEdgeTraverser loEdTrav; brEs = loEdTrav.setLoop(faLoTrav); if(brEs != AcBr::eOk) { // maybe an isolated vertex, just continue continue;
} for(;!loEdTrav.done();loEdTrav.next()) { AcBrEdge edge; loEdTrav.getEdge(edge); AmiGeomKey* pEdgeKey = NULL; amiEs = amiGetKeyFromBrep(&edge, pEdgeKey); if(amiEs != Ami::eOk) { acutPrintf("Cannot create Key from edge ... continuing\n"); continue; } struct resbuf* pRb = acutBuildList(RTLB, RTLONG, 0, RTLONG, (long) pEdgeKey, RTLE, 0 ); pRb->rbnext->rbnext->rbnext->rbnext = pCallingRb; pCallingRb = pRb; keyArray.append( pEdgeKey ); } } delete pFace; struct resbuf*pRb = acutBuildList(RTSTR, "AMFILLET", 0); pRb->rbnext = pCallingRb; pCallingRb = pRb; struct resbuf* pResRb = NULL; if(acedInvoke( pCallingRb, &pResRb ) != RTNORM) { acutPrintf("Failure calling acedInvoke\n"); } int nKeys = keyArray.length(); acutPrintf("Applied Fillet with radius %lf to %d edges\n", radius, nKeys ); for( int i=0; i< nKeys; i++ ) ((AmiObjectKey*)(keyArray.at(i)))->release();
Introduction
Autodesk Mechanical product acceptance and quality are measured by customer perception of not only Autodesk products, but of developer partner products as well. This document presents a set of guidelines and certification requirements to assist our developer partners in their responsibility to deliver high-quality products that integrate well into Autodesk Mechanical products. These guidelines, available to all developer partners, lay the foundation for certification, which allows developer partners to brand their products with a badge symbolizing Autodesk Mechanical product integration and interoperability. Part 1 outlines the Product Development Guidelines that ensure developer partner products work well with the current Mechanical Desktop and AutoCAD Mechanical and with other Autodesk products in the future. Developer partners must follow these guidelines to have their products certified by Autodesk. Part 2 provides the Installation Development Guidelines for developer partners who use the MCAD API in their products. Autodesk recognizes that each developer partner product is unique in its target market, technical complexity, interaction with the Mechanical Desktop, and packaging. This document, which will change over time with product evolution, is a guideline for all of these products. As new requirements are identified, they will be incorporated into future versions of this document. If you have any questions about whether your product(s) meet these requirements, contact your standard registered developer support channel.
Part 1
Product Development Guidelines
These guidelines, available to all developer partners, must be followed by those who wish to have their products certified by Autodesk. The guidelines ensure that developer partner products work well with the current Mechanical Desktop, AutoCAD Mechanical, and with other Autodesk mechanical products in the future.
1. Follow All ObjectARX Developer Guidelines Meaning All Autodesk issued guidelines for development of ObjectARX applications, which are included in the ADN CD collection, must be followed. When a certification process is put in place for ObjectARX applications, all the requirements for that process must be satisfied.
Motivation
Your application is an ObjectARX application. Thus, you must follow all basic ObjectARX guidelines as well as all developer partner development and certification guidelines to ensure integration into our environment.
Considerations
Autodesk provides extensive documentation, training, and email support to enable developers to achieve this goal.
2. Be Compatible with Autodesk Mechanical Solutions and Other Partner Applications Meaning Your application should not conflict in any way with the Autodesk Mechanical solutions or with other partner applications. This includes, but is not limited to, installation, deinstallation, database coexistence, loading and unloading of files, handling of menus and help files, ability to go back and forth between Autodesk Mechanical solutions and partner applications, and opening of files containing objects created by your application when your application is not present. Applications should have capability to load and unload during an Autodesk Mechanical solution session, allowing the user to control overall memory usage.
Motivation
End users want to be able to mix and match different developer partner applications with the Autodesk Mechanical solutions.
Considerations
Many of the issues raised here are addressed by the use of commonly known, good programming practices. If you have access to other developer partner applications for the Mechanical Desktop, test your application with these products.
3. Have a Consistent End User Paradigm Meaning Design your application to look and feel like a natural extension of AutoCAD and the Autodesk mechanical solutions and to be Windows compliant.
Motivation
Users want to have seamless integration without drastic paradigm changes as they use AutoCAD, the Autodesk mechanical solutions and developer partner applications.
Considerations
In some cases it might make sense to deviate from the established paradigm to enable new functionality or facilitate a task, but this should be the exception rather than the rule and needs to be justified.
4. Use AutoCAD Tools Meaning Your product should use, as much as possible, tools that are native to the AutoCAD environment. This includes, but is not limited to, utilizing the standard mechanisms for graphics display, manipulation, picking/grips, and highlighting; file handling; entity copy, delete, move, rotate, mirror and scale; grouping and blocking; and rendering, if appropriate. If some of these standard AutoCAD operations are not applicable, it is your responsibility to react to operations accordingly. Note that the use of MFC tools is also encouraged.
Motivation
End users want to continue using familiar AutoCAD interactions whenever possible.
Considerations
By having your application objects derive from AcDbObject and AcDbEntity, and by implementing the appropriate virtual methods, many AutoCAD native commands automatically work on your entities.
5. Have Complete Geometric Coverage Meaning Operations that involve geometry should work on all applicable types, including all types of curves and surfaces, geometry that is wireframe, Mechanical Desktop surfaces, a solid, a parametric part, an assembly component, inside block references, and external databases. If an operation is appropriate only for a particular geometry type, the user interface should trap the condition and clearly notify the user.
Motivation
Users do not want their applications to work for only certain geometric configurations.
Considerations
Full geometric coverage is easily accomplished through the use of the geometric keys provided by the MCAD API. By using these keys, developers are automatically relieved of dealing with the underlying details of the type(s) of geometry that are members of composite
05/12/2001 Page 252
entities such as polylines, blocks, or groups; inferred geometry such as end points, mid points, center points, axes, or planes; and geometry that is externally referenced from other files.
6. Extract All Model Information Meaning Information that is already present in an Autodesk Mechanical solution model should be extracted automatically by applications that need it. Users should not have to re-enter common attribute information, such as material properties. Other, higher level examples would be that assembly constraints can be extracted automatically from the model and used in defining joints for a kinematics application, loads calculated by kinematics applications can be used by FEA applications, and that design parameters can be used for shape optimization in a CAE or mold flow application.
Motivation
Users do not want to spend time reentering information that was previously specified to the system.
Considerations
A developer who believes that it is not possible to access the required information should contact Autodesk to remedy the problem.
7. Be Associative Meaning All your application objects which are related to objects in an Autodesk mechanical solution model should have the ability to update themselves in response to changes in the Autodesk Mechanical solution model.
Motivation
Users expect applications to be intelligent in their association to the underlying model across edits to the model.
Considerations
The MCAD API provides a variety of tools that make it straightforward for developers to write associative applications in a variety of flavors to fit different application paradigms. By retaining MCAD API keys, an application can update geometric and other entities across model regenerations, add attributes that are associative, and get active and passive notification of changes.
8. Use Standard Attributes and Objects Meaning Sharing of higher level information requires the use of persistent, sharable attributes created by developer partners. Developer partners should use, whenever applicable, standard attributes, MCAD API instantiable attributes, objects defined by the MCAD API, and additional attribute data defined by developer partner applications instead of defining their own versions. If an application creates objects which have a natural representation within the Mechanical Desktop, that representation should be used. For example, solids should be represented using parts; assembly structures should be made as Mechanical Desktop assemblies.
Motivation
The use of commonly defined objects promotes interoperability across different applications. In addition, a standard attribute that is attached by one application can be operated upon by another application, even when the application that planted the attribute is not loaded.
Considerations The
instantiable attributes mechanism provided by the MCAD API in combination with standard attribute definitions provide a convenient way for applications to deal with attributes without the burden of having to write supporting code for the classes involved.
9. Use DWG File to Store All Model Data Meaning Have all the data that defines your model saved with the DWG file format instead of using additional files to save part of the model definition.
Motivation
This approach avoids complications when users exchange data. It facilitates support for several operations involving database manipulation (such as undo/redo operations).
Considerations
Large data sets could represent an exception to this rule. Examples would be derived NC tool paths, and FEA results. In applications that have large data sets, the user should be able to store the file without this data if so desired.
10. Support Undo/Redo Meaning All your application objects should fully support undo and redo operations as presented by AutoCAD.
Motivation
Users have come to expect this, and it is a key feature of our environment.
Considerations
This can be accomplished by following the ObjectARX development guidelines concerning implementation of the appropriate dwgin/out methods for all application classes.
11. Have a High Level of Quality Assurance Meaning The development of your application should be done in a context of high concern for overall quality.
Motivation
The development environment that ObjectARX/MCAD APIs provide is very powerful and complex. Quality problems in your application have the potential to impact other applications as well. Users expect the highest standards of quality from suites of partner applications. This is, in a way, an obvious point, but it should not be taken for granted.
Considerations
12. Support Globalization Meaning Your application should be localization ready for all the markets where Autodesk mechanical products are sold. The ObjectARX developer guidelines provide information on how to structure your application to achieve this.
Motivation
Ours is a global market, and having the applications adapted to the different countries where they are sold is a key user requirement.
Considerations
In order to have this process go smoothly, pay attention to globalization throughout the product development. Autodesk has available documentation, strategies, and training material to help developers support globalization in their products. This information can be obtained from your standard registered developer support channels.
13. Stay Current Meaning Continue to update your application to account for enhancements made to AutoCAD, the Autodesk mechanical solutions, the MCAD APIs, and to common object definitions. The developer partner is responsible for validating the compatibility of its products with all new versions of Autodesk mechanical solutions and the MCAD API that are made available to developers.
Motivation
As we continue to make improvements in Autodesk mechanical products it is in the best interest of everyone that these enhancements be reflected in additional functionality in your products. It is also important that all applications are available as soon as possible after a revision of the Mechanical Desktop is available.
Considerations
We plan to enhance the Autodesk mechanical products and APIs on an ongoing basis and to keep developers informed of these advances. Many of our future enhancements will
05/12/2001 Page 254
originate from requests and feedback from developer partners and developers in general. ObjectARX and especially the MCAD API provide upward compatibility between Autodesk Mechanical solutions revisions, allowing developer partners to rapidly validate support for new revisions.
14. Pursue Interoperability with Other Partner Applications Meaning Strive to have your application work synergistically with other certified developer partner applications.
Motivation
End users experience great benefit from suites of applications that work well together. For example, an analysis application could use forces calculated by a dynamics application as load conditions.
Considerations
To achieve interoperability, partners should interact closely with each other. In addition, Autodesk will continue to promote and assist in these cooperation efforts.
Part 2
Installation Development Guidelines
These guidelines for the design of developer partner applications installations must be followed.
1. What Product to Use for Installation The Autodesk Mechanical Desktop uses the InstallShield product for its installation. We recommend that developer partners do the same. More information can be found at the InstallShield web site at http://www.installshield.com. 2. Menu Changes The Autodesk Mechanical Desktop uses a menu replacement method. Developer partners should use the Menuload option when they need to add items to a menu or to add a new pulldown. This will allow the addition of new pulldowns to a menu without editing menus added by the Mechanical Desktop or by other developer partner applications. For more details see chapter 4, Custom Menus, in the AutoCAD Customization Guide. 3. The ACAD.RX and Loading of Applications It is highly recommended that you consider using demand loading of your application instead of using the acad.rx. Refer to Loading an ARX Application in Chapter 3 of the ObjectARX Developers Guide for information about demand loading. 4. Installation of Your Application in Its Own Directory A developer partner application should install into its own directory off a root drive. To have your application run with the Mechanical Desktop, your installation will have to edit the acad.ini found in the mcad or equivalent directory to add your path to the acad path statement. This is needed to load your application when the Mechanical Desktop is loaded. 5. Look and Feel of Your Application Installation The look and feel of a developer partner application installation should match that of the Mechanical Desktop. Using InstallShield automatically ensures this is done.
NOTE: Custom objects that might hold keys are also proxies when the application that created them is not present. How can I see what objects a given attribute is attached to? The amiGetAttributeHolders() function creates an array of keys to objects to which the attribute is attached. These keys will be new keys, not the ones through which the attribute was originally attached. You may want to compare the keys returned to your existing keys to see if they are equal with amiAreKeysEquivalent(). Does active notification allow me to stop a change taking place? In general, no. You can react to the changes, but cannot veto the changes taking place. Do I need to store all the application data inside the AutoCAD database? No, this might not make sense, depending on the application. For example, an NC application will certainly want to store objects in the database, associated with particular faces, to ensure that the NC toolpath is calculated associatively. The toolpath data itself, however, could be stored in an external file. This would reduce the size of the drawing, while still preserving the associativity of the NC path. How do I get the geometry of a curve key? This is done by obtaining the geometry of the key, and then obtaining the native curve from this, as shown by the following code snippet (the sample application provided with the MCAD API contains detailed code to illustrate this).
stat = amiGetGeomData(pCurveKey pGeEntity); if( stat != Ami::eOk ) { acutPrintf("Cannot get geom key %d\n", stat ); return; } int type = pGeEntity->type(); if( type != AcGe::kExternalCurve3d ) { acutPrintf("Curve is not external"); return; } AcGeCurve3d* pCu; AcGeExternalCurve3d *pGeExtCu = (AcGeExternalCurve3d *) pGeEntity; if( !pGeExtCu->isNativeCurve( pCu ) ) { acutPrintf("Curve is not a native curve\n"); return; } if( pCu->type() != AcGe::kCircArc3d ) { acutPrintf("Curve is not a circle\n"); return; }
What happens to geometric keys if the containing Entity is replaced? Certain operations will cause an Entity to be replaced by another kind of entity. The resulting entity will visually appear the same to the user. For example, calling the command EXPLODE on a Part will cause the Part to be replaced by an AcDb3dSolid. The Solid contains the same B-rep information as the Part but without the Parts parameter and feature data. If keys existed on any geometry of the Part prior to the explode, they will be lost during the explode, even though the resulting Solid contains subentities that are geometrically identical. If the key has active notification enabled, the notification will be sent that the object referenced by the key has been erased. The following are known cases where geometric keys are lost:
Creating a component from a Solid or Part, using AMNEW Creating a Part from a Solid using AMNEWPART Creating a Region from a set of Curves, using REGION Exploding an entity, such as Component, Part, Solid, Region, or Body
Does the MCAD API allow me to access the data of Mechanical Desktop objects that are currently proxies because the Mechanical Desktop is not loaded? No, the MCAD API will not be able to access AutoCAD Designer or AutoSurf entities unless these programs are loaded.
AnnotAttribute
midm.h
AnnotType
midm.h
Centerline Generic (any mechanical note). Balloon callout. Weld symbol. Surface texture annotation. Feature ID. Control frame. Datum target. Datum identifier. AcDmUserDefnNote annotation. Old. Old. Old. Old. Concentric locator. Distance from locator. Aligned locator. Perpendicular locator. Parallel locator. Collinear locator. Tangent locator. Horizontal locator. Vertical locator. Coincident locator. On plane locator. Absolute locator. Angled locator.
mifeat.h
Enum Type
AttrAssocType
kCopyAlways kShareAlways kIgnoreAlways AttributeDataType attTypeInt attTypeDouble attTypeCharPtr attTypeEnum attTypePoint3d attTypeMatrix3d attTypeEntity3d attTypeObjectKey attTypeValue attTypeExternalId attTypeSpecial kInstantiable kAmiDerived kInstOrDerived
Additional Information Offset locator. Coordinate system locator. Do not specify how the attribute is handled. The current default behavior is to share the attribute. Also copy the attribute and attach the new attribute copy to the new object. Attach the same attribute to the new object. Do not attach this attribute to the new object.
Header File
miattrib.h
mibase.h
AttrMatchType: When retrieving all attributes, this type is used to qualify the attributes returned by type. AttSpecialValues AxisDirType
miattrib.h
ConstraintType
attNAV kPositiveX kNegativeX kPositiveY kNegativeY kXAxisPos kYAxisNeg kXAxisNeg kYAxisPos kEqualDist kTwoDist kDistAngle kBase kJoin kCut kIntersect kSplitPart eConstraint eCompConstraint eCompMate eCompFlush eCompInsert eCompAngle
mibase.h mibase.h
Equal distance chamfer. Two distances chamfer. Distance and angle chamfer. Create base feature operation. Join operation. Cut operation. Intersection operation. Split operation. Assembly constraint, no type information Used for creating a mate, e.g. distance constraint, no argument type specified Used for creating a flush, e.g. distance constraint, no argument type specified. Used for creating insert constraints between two circular edges or faces Used for creating an angle constraint between to model edges
mifeat.h
mifeat.h
miconstr.h
Enum Type
Category/Enum eSketchConstraint eSkHorizontal eSkVertical eSkParallel eSkColinear eSkPerpendicular eSkProjection eSkPointCoincidence eSkCoincident eSkConcentric eSkTangent eSkXEqual eSkYEqual eSkEqualRadius eSkCircleCoincidence eSkPointCurveCoincidence eSkCenterPoint eSkEqualLength eSkFixed eSkMirror eSkDistance eskAngle eSkRadius eSkHorDistance eSkVerDistance eSkAlignDistance eSkDiameter eSkEllRadiusMajor eSkEllRadiusMinor eSkAlignDiamDistance
Additional Information Sketch constraint, no type information Sketch horizontal constraint query and creation Sketch vertical constraint query and creation Sketch parallel constraint query and creation Sketch colinear constraint query and creation Sketch perpendicular constraint query and creation Sketch projection constraint query and creation Sketch coincident point constraint query and creation. Sketch coincident constraint query and creation. Sketch concentric circles constraint query and creation Sketch tangency constraint query and creation Sketch align circle centers along x axis constraint query and creation Sketch align circle centers along y axis constraint query and creation Sketch equal radius constraint query and creation Sketch coincident arc constraint Not used Not used Sketch constraint to maintain that two lengths are equal Sketch fixed geometry constraintquery and creation Sketch mirror constraintquery and creation Sketch distance dimension general type Sketch angle dimension Sketch radius dimension Sketch horizontal distance dimension Sketch vertical distance dimension Sketch aligned distance dimension Sketch diameter dimension Sketch ellipse major radius dimension Sketch ellipse minor radius dimension Sketch constrain a line to be a set distance from a point, anywhere around the point Sketch the base point for x ordinate dimensions (0 point) Sketch the base point for y ordinate dimensions (0 point) Sketch distance along x axis from the x base dimension Sketch distance along y axis from the y base dimension Sketch parallel distance dimension
Header File
Enum Type
Category/Enum eSkSize
ConstrAttribute
csAttDisplayed
csAttDisplayId csAttMaxOperands
csAttMinOperands
csAttOperand1 csAttOrientation1
casAttOperand2 csAttOrientation2
Additional Information Used to signify the last member of the enumerated set for used during iteration etc. AmiConstraintType Parametric value associated with constraint, AmiValue Location for the display of the constraint/dimension Read-only flag indicating whether the constraint is displayable in a persistent mechanism Flag indicating (during query) if the constraint is displayed or (during construction) should be displayed The database id of the entity used to display the constraint Read-only data indicating the maximum number of operands the constraint supports Read-only data indicating the minimum number of operands the constraint requires Geometry key referencing the first operand of the constraint AmiNormalOrientnType indicating whether the constraint should be enforced with the existing normal or a flipped normal for the referenced geometry Geometry key referencing the second operand of the constraint AmiNormalOrientnType indicating whether the constraint should be enforced with the existing normal or a flipped normal for the referenced geometry Right handed coordinate system. Left handed coordinate system. Database contains only components, no parts. Database contains only a single part, no components. File was created on a newer version of Mechanical Desktop. This state will never be saved to a file. Database contains more than one part, no components (legacy data). Database contains both components and parts (legacy data). No parts or components in file. Mechanical Desktop applications not loadedfile state cannot be determined. Developing the model, whether assembly or part. Creating drawings. Creating scenes for assemblies. When there is no database. Number of vars in constraints/equations.
Header File
miconstr.h
mifeat.h
mibase.h
kMultiPart kMixed kForeign kUnknown DesignModelType kModelMode kDrawingMode kSceneMode kUninitialized dofAttNumVars
mibase.h
DOFAttribute:
miDOF.h
Enum Type Degree of Freedom (DOF) information. Used to describe classic rigid-body motion in space, or for DOFs associated with systems of equations/constraint s, e.g. sketching. DrivingData
Category/Enum dofAttNumFreeVars dofAttNumDOF dofAttNumRDOF dofAttNumTDOF dofAttRotationAxis dofAttTranslationAxis dofAttRotationPoint kParamData kFeatData kParamAndFeatData kNullContext kNewDrawing kDeepCloneToCurDwg kDeepCloneFromCurDwg kDeepCloneWithinCurDwg
Additional Information Number of free vars. Number of rigid-body DOF remaining Number of Rotational DOF remaining Number of Translational DOF remaining. Axis/axes of rotation. Axis/axes of translation. Point on rotation axes (if needed). Table driving parameters. Table driving feature suppression. Table driving both parameters and feature suppression. Event occurred during typical modeling processes Event occurred during while creating a new drawing Event occurred cloning objects into the current drawing Event occurred cloning objects out of the current drawing Event occurred cloning objects within the current drawing Bookkeeping eventalways the first event. Version/parameter controlling file was attached AmiFileNotifFcnPtr Version/parameter controlling file was detached AmiFileNotifFcnPtr New version definition was added to a version/parameter file. AmiFileVerFcnPtr Not Supported Version was activated. AmiKeyVerFcnPtr Table notification. Not supported. Table notification. Not supported. Designer event, part activated. Ami1KeyNotifFcnPtr Designer event, part created. Ami1KeyNotifFcnPtr Designer event, part compute. Ami1KeyNotifFcnPtr Designer event, part erased. Ami1KeyNotifFcnPtr Designer event, feature created. Ami1KeyNotifFcnPtr Designer event, feature erased. Ami1KeyNotifFcnPtr Designer event, feature renamed. Ami1KeyNotifFcnPtr Designer event, feature excluded due to versioning. Ami1KeyNotifFcnPtr Designer event, feature suppressed. Ami1KeyNotifFcnPtr Designer event, feature reactivated due to versioning. Ami1KeyNotifFcnPtr
Header File
mifile.h
mievent.h
EventType
kFirstEvent kOnAttachFile kOnDetachFile kOnNewVersion kOnEraseVersion kOnActivateVersion kConflictDetected kConflictResolved kOnActivatePart kOnNewPart konUpdatePart kOnErasePart kOnFeatureAdded kOnFeatureRemoved kOnFeatureRenamed kOnFeatureVersioned kOnFeatureSuppressed kOnFeatureUnversioned
mievent.h
Enum Type
Category/Enum kOnFeatureUnsuppressed kOnWorkGeomAdded kOnWorkGeomRemoved kOnWorkGeomRenamed kOnWorkGeomVersioned kOnWorkGeomSuppressed kOnWorkGeomUnversioned kOnWorkGeomUnsuppresse d kOnFeatureReorder kOnReplayTruncated kOnFeatureReplayed kOnNewConstraint kOnEraseConstraint kOnNewCompDef kOnNewComp kOnNewScene kOnNewCompView kOnEraseCompDef kOnEraseComp kOnEraseScene kOnEraseCompView kOnRenameComp kOnRenameCompDef kOnContextSwitch kOnReorderComp kOnExternalizeCompDef
kOnLocalizeCompDef kLastEvent FeatState: Feature state enumeration. Used to create bit kAll kActive
Additional Information Designer event, feature unsuppressed. Ami1KeyNotifFcnPtr Work-geometry created. Ami1KeyNotifFcnPtr Work-geometry erased. Ami1KeyNotifFcnPtr Work-geometry renamed. Ami1KeyNotifFcnPtr Work-geometry excluded due to versioning. Ami1KeyNotifFcnPtr Work-geometry suppressed. Ami1KeyNotifFcnPtr Work-geometry reactivated due to versioning. Ami1KeyNotifFcnPtr Work-geometry unsuppressed. Ami1KeyNotifFcnPtr Feature moved above destination feature Ami2KeyNotifFcnPtr Replay notification. Not supported. Replay notification. Not supported. Constraint. created Ami1KeyNotifFcnPtr Constraint erased. Ami1KeyNotifFcnPtr Assembly events. Comp Def Created Ami1KeyNotifFcnPtr Assembly events. Component added Ami1KeyNotifFcnPtr Assembly events. Scene added Ami1KeyNotifFcnPtr Assembly events. Component view added Ami1KeyNotifFcnPtr Assembly events. Comp Def erased Ami1KeyNotifFcnPtr Assembly events. Component erased Ami1KeyNotifFcnPtr Assembly events. Scene erased Ami1KeyNotifFcnPtr Assembly events. View erased Ami1KeyNotifFcnPtr Assembly events. Component renamed Ami1KeyNotifFcnPtr Assembly events. Comp def renamed Ami1KeyNotifFcnPtr Assembly events. Current comp def context changed Ami1KeyNotifFcnPtr Assembly events. Component order changed Ami1KeyNotifFcnPtr Assembly events. Formerly local Comp def externalized to a file Ami1KeyNotifFcnPtr Assembly events. Formerly external comp def localized Ami1KeyNotifFcnPtr Bookkeeping event. Always the last event. Used to control iterations. Used when querying for an array of features means to return all features. The feature is not currently excluded.
Header File
mifeat.h
Enum Type fields telling functions returning features what feature states were interested in. For example, if you call amiGetPartFeats and want all features, you pass in Ami::kAll. If you want only active features, pass in Ami::kActive. If you want only active and suppressed features, pass in ami::kActive | Ami::kSuppressed. FeatType: Feature type enumeration.
Category/Enum kSuppressed
Additional Information The feature was excluded via the AMSUPPRESS command or the API function AmiSuppressFeat. The feature was excluded via a spreadsheet.
Header File
kHole kDrilledHole kBoreHole kSinkHole kExtrusion kRevolve kChamfer kFillet kSweep kArray kRecArray kPolarArray kBaseFeat kSurfCut kUniFillet kIndFillet kFixedFillet kCubicFillet kLinearFillet kShell kParametricBool kConstrGeom kWorkPoint kWorkAxis kWorkPlane kLoft kDraft kPlaneDraft kEdgeDraft kShadowDraft kSplit kFaceSplit kPartSplit kSketchPlane kAttFileType kAttFullPath kAttManaged
General hole feature Drilled hole feature Counter bore hole feature Counter sink hole feature Extrusion feature Revolution feature Chamfer feature General fillet feature Sweep feature General feature array feature Rectangular feature array feature Polar feature array feature Base feature Surf cut feature Uniform radius fillet feature Individual radius fillet feature Fixed radius fillet feature Cubic variation fillet feature Linear variation fillet feature Shell feature Parametric boolean (combine) feature General constrained geometry Work point Work axis Work plane Loft feature Face draft feature Draft from plane feature Draft about edge feature Shadow draft feature Split feature Face split feature Part split feature Sketch plane Full path to file on disk Flag indicating whether the file is managed by the active PDM system
mifeat.h
mifile.h
Enum Type
Additional Information For Managed files the group to associated with the file For Managed file the predefined properties flag indicating the type of file for the PDMs use Managed file attributes. Are versions defined across rows or down columns of the spread sheet The spreadsheet has information for parameters, suppression or both Are the sections for parameters and suppression on one sheet (concatenated) or on separate sheets Name of the sheet holding feature suppression information Cell id for the first cell of feature suppression information Name of the sheet holding parameter definitions Cell id for the first cell of parameter definitions Id of the object controlling this file File used in Table Driven Parts to define versions within a model File containing parameter definitions General spreadsheet External file used for input to a process External file created as output from a process Show calculated hidden lines. Dont show hidden lines. Dont show and dont store hidden lines.
Header File
kAttFeatSheet kAttFeatCell kAttParamSheet kAttParamCell kAttVersionedObj kVersioningFile kParameterFile kSpreadsheet kExternalInput kExternalOutput HiddenLineTreatm ent: The kHiddenLinesNotDi splayed setting causes hidden lines to be generated and stored, not just displayed. Therefore, the kHiddenLinesDispla yed and kHiddenLinesNotDi splayed settings will exhibit roughly the same performance and file sizes, while kHiddenLinesDiscar ded is more efficient when the lines are not expected to be displayed. They can be regenerated when switching to kHiddenLinesDispla yed. Relevant only for ViewDispType !=kWireFrame. KeyType: kHiddenLinesDisplayed kHiddenLinesNotDisplayed kHiddenNoTangDisplayed
FileType
mifile.h
midm.h
objectKey
mibase.h
05/12/2001 Page 266
LoftType
ModelStateType
Category/Enum geomKey pointKey curveKey lineKey arcKey ellipseKey splineCrvKey polylineKey augLineKey surfKey planeKey coneKey cylinderKey sphereKey torusKey splineSrfKey constrKey compConstrKey sketchConstrKey paramKey sketchKey featKey bodyKey solidKey partKey compKey compDefKey sceneKey vectorKey dwvwKey DwAnnotKey sketchPlaneKey size kAlignNone kAlignAutomatic kAlignProportional kAlignCorner kLinear kCubic kClosedCubic kActiveStable kActiveEdited kInactive kAffected kMaybeAffected kMaintenance kRaw kReversed
Additional Information
Header File
mifeat.h
NormalOrientnType
Is the current active part, and is stable. Edited, needs regen. Not the active part, and not under edit. Not active, but affected by edits. Maybe affected by current edits, not active. Active part but in a maintenance mode. The geometry normal should be interpreted as it is native in the model The geometry normal should be interpreted as the inverse (or flipped) from how it occurs in the model
mibody.h
mibody.h
NotifType
midm.h
PolarAngleType: Polar array angle type. ReactAttribute: Reaction attribute keyword enumeration.
Category/Enum kRight kLeft kTop kBottom kFront kBack kTopRight kBottomLeft kTopLeft kBottomRight kBaseOrientation kNone kFillAngle kFullAngle kIncrAngle kFirstAttribute kEvent kFunction
kLastAttribute SceneCompAttribut e SectionCutDirection SectionStructure SectionType SketchType scpAttTransform scpAttIsSuppressed scpAttExplodeFactor kCutRight kCutLeft kConcatenated kSeparate kSecNone kSecHalf kWorkPointSketch kClosedProfile kPath kCutLine kUnknownSketch kSplitLine kAxisProfile kHelicalPath Codes shared with Acad::ErrorStatus eOk eMakeProxy Codes shared with AcMe::Status eInternalUnsupported General Ami codes eBad eInvalidArg eNoImpFunc eNoImplementation eOutOfMemory eNullKey
Additional Information Ortho. Ortho. Ortho. Ortho. Unused. Unused. Iso. Iso. Iso. Iso. Base. No angle. Angle specifies total angle of rotation. Rotate full circle. Angle specifies angle between instances. Data type. Bookkeeping attribute: always the first attribute. AmiEventType Pointer to the callback function. Ami1KeyNotifFcnPtr, Ami2KeyBoolNotifFcnPtr Bookkeeping attribute: always the last attribute. Transformation matrix. Visibility within scene. Explosion factor override. Cutting direction for kSecHalf. Cutting direction for kSecHalf. Data sections joined together. Data sections are separate.
mifeat.h
mievent.h
miscene.h
Work point. Closed profile. 2d path. Cut line. Unknown (error condition). Split line. Axis profile. 3d helical path.
misketch.h
(==AcMe::eNotSupported) Generic Ami badness Invalid argument passed in. No implementation function available. Called function does not work with arg type. Out of memory. Key not set.
05/12/2001 Page 268
Enum Type
Category/Enum eObjectNotEditable eNoKeySupported eGKeyNotSupported eKeyCreationFailure eNotGeom eTypeMapFailure eNotApplicable Components/Constraints eNoConstraints eNoChildren eExternalComponentNotFou nd Names eInvalidName eNameAlreadyExists Picking Status eUserTermination eUserEscape Instantiable Attributes eNoClassRecord eClassRecordAlreadyExists eClassRecordInDb eFieldIndexOutOfRange eInvalidFieldName eInvalidFieldType eAttributeReadError Sketch Constraints eInvalidSketchConstrType Parameters eParamAlreadyExists eExprEvalFailure eIllegalExpression eParamNotFound eCyclicDependency Feature Descriptors eUnsupportedFeatType eNoCombiner eNoLocator eNoTerminator Component Containment eUnmatchedLeafObject
Additional Information Object cannot be edited. Key creation not supported for a given argument. Geom key creation not supported for object. Key could not be created. Implied object is not geometry. Failure in type mapping.
Header File
Used to be eInvalidComponentName. Used to be eComponentNameAlreadyExists User termination. User-requested cancel. No definition exists for attribute. Attribute of the same name already registered. Attribute of type exists in the current database. Field index is out of range. Field by given name not defined for attribute. Field type not defined for attribute. Error reading attribute from filer.
Parameter references, at least indirectly, a parameter which uses it. Feature type not supported by feature API. Feature contains no combiner operation. Feature contains no locator. Feature contains no terminator. The component specifies a leaf object (e.g. part) which does not fit or match the leaf required
Specified part is not the active part. Ambiguous part information specified for combine.
Enum Type
Category/Enum eNoPartInstance Descriptors eAttReadOnly eAttTypeMismatch eAttValueNAV eIllegalDescriptor eAttMultiValued eAttNoAppend DwgMgr eBaseView eNoCutlineContext Constraint Creation eInvalidConstrType eArgErased eBadItemType eGeomValidFailure eNoBaseOrdinate eNoConstrainableGeom eNoCommonSketch eNoCommonPart eCoincidentGeom eModelOverConstrained eModelInconsistent eConstraintExists eInternalFailure New general Ami codes eObjectIsProxy eInvalidDesignMode eComputeFailure kParallel kNormal kBlindTerm kThroughTerm kToPlaneTerm kToFaceTerm kFromToTerm kMidPlaneTerm kInsideTerm kOutsideTerm kVersionsAcrossRows kVersionsDownColumns vwAttViewType vwAttScale vwAttDisplayType vwAttLocation vwAttLabel vwAttHatchOnFlag vwAttAHLDisplayOn
Additional Information Specified part has no instance. Attempted update of read-only attribute. Type mismatch on attributes. NAV: Not a Value Descriptor values inconsistent (wrt type). Multi-valued attribute in single-value context. Cannot append to attribute value (not allowed). Illegal operation on base view (e.g. get parent). Sectioning operation requires context for cutline. Invalid or unsupported constraint type. Key to erased data passed. Argument geometry type not supported for constraint type. Geometric validation failed. No base ordinate defined on args. No sketch geometry passed in. Geometry from different sketches. Geometry from different parts. Keys point to same geometry. Constraint would make sketch overconstrained. Constraint inconsistent with existing constraints. Constraint already exists. Internal failure building constraint.
Header File
mifeat.h mifeat.h
VersionConfig ViewAttribute
In the table, versions run across rows. Versions run down columns. General attribute. General attribute. General attribute. General attribute. General attribute. General attribute. General attribute.
mifile.h midm.h
Enum Type
Category/Enum vwAttHatchOnFlag vwAttAHLDisplayOn vwAttHatchAHL vwAttModelEnts vwAttExtents vwAttGap vwAttOrientnPlane vwAttOrientnAxis vwAttOrientnAxisDir vwAttScaleType vwAttParent vwAttOrientation vwAttRefPoint1 vwAttRefPoint2 vwAttRefBoxUL vwAttRefBoxLR vwAttSection vwAttSectionType vwAttSectionLabel vwAttSectionCut vwAttSectionCutDir vwAttShowParDims vwAttShowTapLines kWireFrame kHiddenTangDisp kHiddenNoTangDisp kVwSclAbs kVwSclRel kBaseVw kBrokenVw kOrthoVw kAuxVw kIsoVw kDetVw kGenericVw
Additional Information General attribute. General attribute. Ignored if display type is wireframe. General attribute. Ignored if not sectioned and hatched. General attribute. General attribute. Broken view attributes. Base view attributes. Base view attributes Base view attributes Child view attributes Child view attributes Child view attributes Auxiliary and detail view attributes. Model space geom ref. Auxiliary and detail view attributes. Model space geom ref. Auxiliary and detail view attributes. Auxiliary and detail view attributes. Section view attributes. Section view attributes. Section view attributes. Section view attributes. Section view attributes. View display attributes View display attributes
Header File
ViewDispType
midm.h
ViewScaleType ViewType
midm.h midm.h
Reference: Glossary
Active (leaf node, part)
An active object is the object currently designated for editing. The active leaf node is the selected component through which changes are made to a specific part. The active part is the definition that is modified by changes made to the active leaf node. Changes to the active part are reflected in all instances of that part.
Active Notification
A mechanism that calls a user-registered function when a monitored object is changed or erased. Active notification is used by applications that need immediate notice of changes in the entity. It allows applications to update themselves as the changes occur. It is typically used when Little work is required in updating. Updates are relevant to the user causing the change. Applications have all the information available at the time of the notification, to be able to update.
API
Acronym for Application Programming Interface. A set of tools that provide programmatic access to the functionality in an application.
Associativity (Attributes)
Indicates whether the attribute should be copied, shared or ignored when the object to which it is attached is copied within a database or across databases.
Atomic Locator
A piece of information that describes a discrete aspect of how a feature was located. For example, a hole located at a distance from two edges would contain a single locator made up of two atomic locators. Each of those would contain information about a single edge and a single distance value or parameter determining the value.
Attribute
Application data associated with a particular entity. This user-defined object is conceptually attached to an application object being referred to by a key and can be retrieved given a key to the application object. It could be meant to be private to the functioning of the application, or data which could be meaningfully shared with other applications.
Attribute Class
A runtime description of a particular class of instantiable attribute.
B-rep
A boundary representation of an object used to represent solids, regions, and other ACIS bodies in AutoCAD, that encapsulates topological information on how different parts of the object are related to one another. B-rep objects are represented by their boundaries, consisting of faces, edges, and vertices.
B-rep API
An API that allows access to the internal structure of the B-rep object. The B-rep API allows applications to traverse through the B-rep and obtain adjacency information. Examples of the use of the B-rep API include obtaining the faces of an edge, and obtaining the loops of edges in a face. See the B-rep API documentation for more information.
05/12/2001 Page 272
Glossary
Derived Attribute
An instance of a C++ class which derives from AmiAttribute. These attributes may be attached through API keys to entities. They become proxy objects if the application that defined the class is not loaded.
Feature Descriptor
An object containing all the information used in the construction of a feature. Feature descriptors are used to get feature information as well as to create new features.
Filer
An object that manages an I/O stream. Objects in the AutoCAD database, including those relevant to the MCAD API, are written to and from files using filers. The filers are passed in as arguments to the relevant object member functions and encapsulate information about the file that is being used. As well as providing file access, filers are also used for access to database objects, such as by ads_entget. See the ARX Developers Guide for more information.
GeLib
Same as Geometry Library.
Geometry Key
Applications reference entities within the MCAD API using keys. A geometry key is used to reference geometric objects, such as surfaces, curves, and points.
Ghost
A ghost geometric object is an object that has been erased and whose geometry can still be re-created from a key to the object.
Inferred Geometry
A geometry reference that is implied by the entity selected, and not a direct reference to specific geometry. For instance, if a point reference is desired and a circle is selected, the center point of the circle is inferred and referenced through the point key.
Informer
A piece of information common to all feature descriptors describing how the feature was located or terminated.
Instantiable Attribute
An attribute whose data layout is defined at runtime via an attribute description or "class" definition. Since the data layout is saved to the database with the attributes, the attributes can be shared between applications without the creating application being loaded. Also application developers do not need to implement all the methods associated with new persistent classes.
Key
Applications reference entities within the MCAD API using keys. A key is a persistent referencing object that allows application objects to be referenced from a third-party application. It also protects the application from changes in the object. For example, a key, constructed for a face in a Mechanical Desktop part, will remain valid even though a change in a parameter might cause the solid to be regenerated.
Key Copying
The process that, given a key, creates a second key that resolves to the same entity as the first.
Leaf Node
A component definition is a leaf node if it is not a subassembly. A component is a leaf node if its definition is a leaf node.
Glossary
Locator
A feature informer which specifically describes how a feature was located. A feature locator is made up of one or more atomic locators.
Notification
A mechanism that allows a user to be informed of changes and/or deletions to an object being referred to by a key. Applications using the MCAD API will typically need to reference entities within AutoCAD or the Autodesk Mechanical Desktop. For example, an NC toolpath might reference the faces that it relates to, or a finite element load might be associated with a particular edge. As the referenced entities change, the application may need to know that the entity has changed. This is called notification and is either passive or active.
Object Key
The instantiable base class for all keys. An object key can be used to refer to any application object.
Owner (Attributes)
Indicates whether the database management of the attribute should be done by the API or by some other application. If the API does not own the attribute, the application must clone, save and wblock the attribute at the appropriate times, otherwise the attribute will not follow the associativity type used to attach it, and may not be written to the database.
Passive Notification
Used for applications that want to know whether or not the entity referred to by a key has changed at their convenience. Applications would typically use passive notification if they did not need to react immediately to changes in the entity. This might be because A large amount of work is done in reacting to the change. Changes in the application would not be relevant to the user making the change. The application relies on other changes to take place before it can make its updates. Changes are likely to be repeated and will result in unnecessary updates.
Pick Object
An object that encapsulates all the information needed to create a key to an object.
Refocus
Refocusing changes a reference from one containing object to the equivalent geometry or feature on a different containing object. This allows one to obtain from a given key another key to the equivalent object in the context of another component or of the defining part.
Scope
A key implicitly has a scope in which it was defined. The scope corresponds to the portion of the assembly structure used in the definition of the key.
Terminator
A feature informer which specifically describes how a feature was terminated. For example a terminator could indicate that a given extrusion was terminated to a given model face.
Unused Sketch
An unused sketch is a profile which has not been consumed by a feature.