Description
Adds an object at a specified location to the array, or appends an object to the end of an array.
For example, if you want to insert one integer in an integer array, call the function as follows:
ProArrayObjectAdd (&int_array, 0, 1, (void *)&int_val);
If you want to insert 3 doubles at the second position in an array of doubles, call the function as follows:
Because this call may cause the array to be reallocated, you must pass the address of the array.
Synopsis
#include <ProArray.h>
ProError ProArrayObjectAdd (
ProArray* p_array
/* (In)
The address of the array.
*/
int index
/* (In)
The position at which to insert the objects in the array. If you specify a value less than 0 (PRO_VALUE_UNUSED), the function appends the objects to the end of the array.
*/
int n_objects
/* (In)
The number of objects to add to the array.
*/
void* p_object
/* (In)
The address from which a contiguous set of object data is to be copied into the array.
*/作者: hust65 时间: 2010-12-10 09:59 5#
沒錯,可以用ProE API的ProArray做
另外有空的話你可以研究其他container (可以看做是array的一種)
如 C++ STL裡的vector,MFC的CArray作者: hyccai 时间: 2010-12-13 08:20
旧的问题材没解决,新的问题又来了
ProFeature *feature;
ProSolidFeatVisit(solid,Action,filter,&feature_);
//Action
ProArray *p_array;
p_array = (ProArray*)((ProFeature**)data_)[0];
ProFeattype p_type;
ProFeatureTypeGet(p_feat,&p_type);
ProMdl model;
ProMdlType mdltype;
status=ProAsmcompMdlGet(p_feat, &model);
status = ProMdlTypeGet (model, &mdltype);
if(mdltype!=PRO_MDL_ASSEMBLY)
status=ProArrayObjectAdd(p_array,PRO_VALUE_UNUSED,1,p_feat);
else
status=ProSolidFeatVisit((ProSolid)model,UserAsmFeatVisitAction,UserAsmcompGetFilter,(ProAppData)&data_);
//这地方不对,不知道怎样递归作者: hyccai 时间: 2010-12-13 08:24
顺便问下,如果
typedef struct
{
ProSolid solid;
ProFeattype feattype;
ProFeature *feature
}ExData;
这样定义,在Action里可不可以将指针指到ExData的Feature成员;
还有怎样给他分配内存作者: hust65 时间: 2010-12-13 09:16 7#
(ProAppData)&data_
你說這裡不對是因為compile不過嗎?