//
//  (C) Copyright 2009 by Autodesk, Inc.  All rights reserved.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted, 
// provided that the above copyright notice appears in all copies and 
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting 
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC. 
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to 
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//

#include "micomp.h"
#include "adslib.h"
#include "dbents.h"
#include "math.h"

extern Acad::ErrorStatus postToDb(AcDbEntity* ent, AcDbObjectId& objId);

void component_main();

Adesk::Boolean createComponents(
  AmiCompKey *&pComp1_1,
  AmiCompDefKey *&pComp1Def,
  AmiCompViewDefKey *&pComp1TopDef,
  AmiCompViewKey *&pComp1_1Top);

Adesk::Boolean addComponentView(
  AmiCompKey *&pComp1_1,
  AmiCompViewDefKey *&pComp1FrontDef,
  AmiCompViewKey *&pComp1_1Front);

Adesk::Boolean createAssemblyComp(
  AmiCompDefKey *pComp1Def,
  AmiCompViewDefKey *&pComp1TopDef,
  AmiCompViewDefKey *&pComp1FrontDef,
  AmiCompViewKey *&pComp1_2Top,
  AmiCompViewKey *&pComp1_2Front,
  AmiCompKey *&pComp1_2);

Adesk::Boolean assembleComponents(
  AmiCompViewKey *&pComp1_1Top,
  AmiCompViewKey *&pComp1_2Top,
  AmiCompViewKey *&pComp1_1Front,
  AmiCompViewKey *&pComp1_2Front,
  AmiCompKey *&pAssy1_1,
  AmiCompViewKey *&pAssy1_1Top,
  AmiCompViewKey *&pAssy1_1Front,
  AmiCompDefKey *&pAssy1Def);

Adesk::Boolean modifyAssemblyComponent(
  AmiCompKey *&pAssy1_1,
  AmiCompKey *&pComp1_1,
  AmiCompKey *&pComp1_2,
  AmiCompViewKey *&pAssy1_1Top,
  AmiCompViewKey *&pAssy1_1Front,
  AmiCompViewKey *&pAssy1_1Side,
  AmiCompViewKey *&pComp1_1Side);

Adesk::Boolean addAssemblyComponent(
  AmiCompViewKey *&pAssy1_1Top,
  AmiCompViewKey *&pAssy1_1Front,
  AmiCompViewKey *&pAssy1_1Side,
  AmiCompViewKey *&pComp2_2Front,
  AmiCompViewKey *&pComp2_1Top,
  AmiCompViewKey *&pComp2_1Front);

Adesk::Boolean createSubAssembly(
  AmiCompViewKey *&pComp1_1Top,
  AmiCompViewKey *&pComp2_1Top,
  AmiCompViewKey *&pComp1_1Front,
  AmiCompViewKey *&pComp2_2Front,
  AmiCompViewKey *&pComp2_1Front,
  AmiCompViewKey *&pComp1_1Side,
  AmiCompViewKey *&pAssy1_1Top,
  AmiCompViewKey *&pAssy1_1Front,
  AmiCompViewKey *&pAssy1_1Side,
  AmiCompDefKey *&pAssy1Def);