2011-01-17 09:50 AM - last edited on 2023-08-03 10:30 AM by Doreena Deng
2011-01-17 11:18 AM
Paodekcal wrote:Yes, you can set the index of the hotspot to use. Refer to the
Are there any way the place object using another HOTSPOT. So I can rotate it correctly. And easy.
2011-01-18 04:36 AM
element.object.libInd = part.index; element.object.level = level; element.object.pos.x = x; element.object.pos.y = y; element.object.xRatio = getParams.a; element.object.yRatio = getParams.b; memo.params = getParams.params; element.object.fixPoint = 3; API_Element mask; ACAPI_ELEMENT_MASK_CLEAR (mask); ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, fixPoint); ACAPI_Element_ChangeDefaults(&element,NULL,&mask); err = ACAPI_Element_Create(&element, &memo);Like this?, But It's not work. It's only use default hotspot at the same.
2011-01-18 06:47 PM
Paodekcal wrote:It works for me - I think I'd need to see more of your source code to understand where it's going wrong. I write code through an object wrapper rather than plain C, so it isn't directly applicable to your case, e.g.
But It's not work. It's only use default hotspot at the same. Do you have any example?
Object object("myObjectName"); object.setOriginIndex(3); activeDrawing.put(object);
2011-01-19 03:45 AM
2011-01-19 04:02 AM
switch (menuParams->menuItemRef.menuResID) { case 32500: /* Library Parts */ switch (menuParams->menuItemRef.itemIndex) { case 1: Do_CreateObjectOnFixHotspot(); break; } break; }3. And placing object code that have to fix at comment line
static void Do_CreateObjectOnFixHotspot() { ACAPI_OpenUndoableSession("Test Draw Object With Desired Hotspot"); API_LibPart part; GSErrCode err; BNZeroMemory(&part, sizeof(API_LibPart)); CHANSI2Unicode("ไม้พื้นสมาร์ทวูด10x300x25.gsm", strlen("ไม้พื้นสมาร์ทวูด10x300x25.gsm"), part.file_UName, API_UniLongNameLen); if((err = ACAPI_LibPart_Search(&part, false)) == NoError) { API_Element element; API_ElementMemo memo; BNZeroMemory(&element, sizeof(API_Element)); BNZeroMemory(&memo, sizeof(API_ElementMemo)); double A = 0; double B = 0; Int32 parCount = 0; //---- element.header.typeID = API_ObjectID; err = ACAPI_Element_GetDefaults(&element, NULL); err = ACAPI_LibPart_GetParams(part.index, &A, &B, &parCount, &memo.params); element.object.libInd = part.index; element.object.level = 0; element.object.pos.x = 0; element.object.pos.y = 0; element.object.xRatio = A; element.object.yRatio = B; element.object.fixPoint = 0; //0 is default value //element.object.fixPoint = 1; //Change to this three line ... //element.object.fixPoint = 2; //But location placing hotspot is the same //element.object.fixPoint = 3; err = ACAPI_Element_Create(&element, &memo); ACAPI_DisposeElemMemoHdls (&memo); } ACAPI_CloseUndoableSession(); }
2011-01-21 07:54 AM
2011-01-24 02:34 PM
Paodekcal wrote:I've tested this and it works, although I didn't try your object. If you open the settings of the placed object, does the placement hotspot in the 2D preview remain the same irrespective of the hotspot you pick in the code? If so, perhaps there is an issue with that object. Try a very simple object first (to make sure the code is correct) and work up from there.
2. Write Menu Code By This Functionetc
2011-01-25 03:06 AM
2011-01-25 10:03 AM
Paodekcal wrote:Yes, I used the same.
I use API DevKit 14. And you?