设为首页收藏本站

中国膜结构网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

膜结构车棚
膜结构车棚膜结构资质国产膜材 膜结构网中国膜结构协会
查看: 195|回复: 3

arx源码222

[复制链接]
  • TA的每日心情
    开心
    2021-6-19 14:40
  • 签到天数: 1539 天

    [LV.Master]伴坛终老

    发表于 2020-12-28 14:32 | 显示全部楼层 |阅读模式
    1. bool
    2. myfunc(AcGeLineSeg3d x, AcGeLineSeg3d y, AcGeTol tol)
    3. {
    4.     AcGeVector3d v1 = x.endPoint().asVector() - x.startPoint().asVector() ;
    5.     AcGeVector3d v2 = y.endPoint().asVector() - y.startPoint().asVector() ;

    6.     AcGeVector3d nulvec = AcGeVector3d::kIdentity;

    7.     v1.normalize();
    8.     v2.normalize();

    9.     AcGeVector3d sum = v1+v2;
    10.     AcGeVector3d dif = v1-v2;
    11.     AcGeTol zeroTol;
    12.     zeroTol.setEqualPoint(0.0);
    13.     zeroTol.setEqualVector(0.0);

    14.     if ((sum == nulvec) || (dif == nulvec))
    15.       return false;
    16.      
    17.     //if(sum.isEqualTo(nulvec,zeroTol) || dif.isEqualTo(nulvec,zeroTol))
    18.     //    return true;

    19.     return ! (v1.isParallelTo(v2, tol));
    20. }

    21. void AcGeLineSeg3dTest::intersection()
    22. {
    23.    AcGeTol told;
    24.    double dtold=0.1;
    25.    told.setEqualPoint(dtold);
    26.    //told.setEqualPoint(1.0);
    27.    told.setEqualVector(dtold);
    28.    //told.setEqualVector(0.01);
    29.    AcGePoint3d ptInsd1;

    30.    

    31.    Adesk::Boolean retdx = Adesk::kTrue, retd1= Adesk::kTrue;
    32.    double deltad = 1e-5, gap = 0.0;

    33.    unsigned long long x=0, NN=100000;

    34.     x=NN;

    35.    while(x--!=1)
    36.    {
    37.        AcGePoint3d pt1Adl(0.0,0.0+gap,0.0);
    38.        AcGePoint3d pt1Bdl(100.0,0.0,0.0);
    39.        AcGePoint3d pt2Adl(0.0,0.0,0.0);
    40.        AcGePoint3d pt2Bdl(100.0,0.0,0.0);
    41.        AcGeLineSeg3d lSeg1dl(pt1Adl,pt1Bdl);
    42.        AcGeLineSeg3d lSeg2dl(pt2Adl,pt2Bdl);
    43.              retdx = lSeg1dl.intersectWith(lSeg2dl,ptInsd1,told);
    44.        retd1 = myfunc(lSeg1dl, lSeg2dl, told);
    45.        if((retd1!=retdx))
    46.            break;
    47.        gap+=deltad;
    48.        //pt1Ad.set(pt1Ad.x+gap,pt1Ad.y,pt1Ad.z);
    49.        //lSeg1d.set(pt1Ad,pt1Bd);
    50.    }

    51.     CPPUNIT_ASSERT ( !x);

    52.     x=NN;
    53.    while(x--!=1)
    54.    {
    55.        AcGePoint3d pt1Adl(0.00000000 ,0.00000000+gap,0.00000000);
    56.        AcGePoint3d pt1Bdl(100.0000000 ,0.00000000,0.00000000);
    57.        AcGePoint3d pt2Adl(300.00000000 ,0.00000000 ,0.00000000);
    58.        AcGePoint3d pt2Bdl(100.00000000 ,0.00000000 ,0.00000000);
    59.        AcGeLineSeg3d lSeg1dl(pt1Adl,pt1Bdl);
    60.        AcGeLineSeg3d lSeg2dl(pt2Adl,pt2Bdl);

    61.        retd1 = lSeg1dl.intersectWith(lSeg2dl,ptInsd1,told);
    62.        retdx = myfunc(lSeg1dl, lSeg2dl, told);
    63.        if(retdx!=retd1)
    64.            break;
    65.        gap+=deltad;
    66.        //pt1Ad.set(pt1Ad.x+gap,pt1Ad.y,pt1Ad.z);
    67.        //lSeg1d.set(pt1Ad,pt1Bd);
    68.    }
    69.     CPPUNIT_ASSERT ( !x);
    70. return;
    复制代码
    回复


    http://www.mjgw.org/ 专业从事膜结构设计、制作加工、施工安装的膜结构工程服务,能够为客户提供专业的膜结构整体解决方案。做中国最好的膜结构综合服务平台。欢迎大家联系电话:198-7840-1958,QQ:463017170.
    相关关键词:膜结构车棚,膜结构车棚覆盖,膜结构车棚公司,膜结构车棚多少钱,膜结构车棚厂家,膜结构车棚价格,社区膜结构车棚,膜结构车棚膜布厂家 ,膜结构车棚哪家好,膜结构车棚多少钱一米,膜结构车棚报价,膜结构车棚哪里有,膜结构车棚定制,膜结构车棚安装,膜结构车棚设计,膜结构车棚电话,膜结构车棚加工,膜结构车棚膜布价格,膜结构车棚批发,膜结构车棚制造商,膜结构车棚生产厂家,膜结构车棚设计,膜结构车棚施工,膜结构车棚多少钱一平米,膜结构车棚订制,张拉膜车棚,张拉膜车棚覆盖,张拉膜车棚公司,张拉膜车棚多少钱,张拉膜车棚厂家,张拉膜车棚价格,社区张拉膜车棚,张拉膜车棚膜布厂家 ,张拉膜车棚哪家好,张拉膜车棚多少钱一米,张拉膜车棚报价,张拉膜车棚哪里有,张拉膜车棚定制,张拉膜车棚安装,张拉膜车棚设计,张拉膜车棚电话,张拉膜车棚加工,张拉膜车棚膜布价格,张拉膜车棚批发,张拉膜车棚制造商,张拉膜车棚生产厂家,张拉膜车棚设计,张拉膜车棚施工,张拉膜车棚多少钱一平米,张拉膜车棚订制,常用膜材品牌:德国杜肯、法国法拉利、德国海德斯、德国米乐、日本平岗、韩国秀博、比利时希运、美国赫虏伯、中国科宝、上海慧遥。

    使用道具 举报

  • TA的每日心情
    开心
    2021-6-19 14:40
  • 签到天数: 1539 天

    [LV.Master]伴坛终老

     楼主| 发表于 2020-12-28 14:33 | 显示全部楼层
    1. Acad::ErrorStatus BlockWorker::CopyFields(AcDbAttributeDefinition *pAttdef, AcDbAttribute *pAtt  )
    2. {
    3.   Acad::ErrorStatus es = Acad::eOk;
    4.   AcDbObjectId fieldId;
    5.   AcDbDictionaryPointer pDict(pAttdef->getFieldDictionary(), AcDb::kForRead);
    6.   if(pDict.openStatus() == Acad::eOk)
    7.   {
    8.     std::auto_ptr<AcDbDictionaryIterator> pDictIter(pDict->newIterator());
    9.     for(;!pDictIter->done();pDictIter->next())
    10.     {
    11.       AcDbObjectPointer<AcDbField> pField(pDictIter->objectId(),AcDb::kForWrite);
    12.       if( (es = pField.openStatus()) != Acad::eOk)
    13.       {
    14.         acutPrintf(_T("\nFailed to open Field :\nLine %ld [%s] In function %s "),
    15.           __LINE__, acadErrorStatusText(es),_T(__FUNCTION__));
    16.         continue;
    17.       }

    18.       AcDbField *pNewField = new AcDbField(
    19.         pField->getFieldCode(AcDbField::kAddMarkers),pField->isTextField());

    20.       if(pField == NULL)
    21.       {
    22.         es = Acad::eNullObjectPointer;
    23.         acutPrintf(_T("\nFailed to create Field  :\nLine %ld [%s] In function %s "),
    24.           __LINE__, acadErrorStatusText(es),_T(__FUNCTION__));
    25.         continue;
    26.       }

    27.       if( (es = pNewField->postInDatabase(m_pDb)) != Acad::eOk)
    28.       {
    29.         acutPrintf(_T("\nFailed to add Field to Database :\nLine %ld [%s] In function %s "),
    30.           __LINE__, acadErrorStatusText(es),_T(__FUNCTION__));
    31.         delete pNewField;
    32.         continue;
    33.       }

    34.       if( (es = pAtt->setField(pDictIter->name(),pNewField,fieldId)) != Acad::eOk)
    35.       {
    36.         acutPrintf(_T("\nFailed to set Field :\nLine %ld [%s] In function %s "),
    37.           __LINE__, acadErrorStatusText(es),_T(__FUNCTION__));
    38.         continue;
    39.       }

    40.       if( (es = pNewField->evaluate(0,0))  != Acad::eOk)
    41.       {
    42.         acutPrintf(_T("\nFailed to evaluate Field :\nLine %ld [%s] In function %s "),
    43.           __LINE__, acadErrorStatusText(es),_T(__FUNCTION__));
    44.       }

    45.       if( (es = pNewField->close()) != Acad::eOk)
    46.       {
    47.         acutPrintf(_T("\nFailed to close Field :\nLine %ld [%s] In function %s "),
    48.           __LINE__, acadErrorStatusText(es),_T(__FUNCTION__));
    49.       }
    50.     }
    51.   }
    52.   return es;
    53. }
    复制代码
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2021-6-19 14:40
  • 签到天数: 1539 天

    [LV.Master]伴坛终老

     楼主| 发表于 2020-12-28 14:38 | 显示全部楼层
    1. // Does a lowercase match each character in sMatchChars to a character in the string sSource
    2. // (also lower case).
    3. // Each match is done in sequence. When the first character is found from sMatchChars the
    4. // next character from sMatchChars is searched for the current position of sSource to
    5. // the end of sSource string.
    6. // The position of each match is stored in the vector index that is passed by reference.
    7. // Returns true if all sMatchChars are found before reaching the end of sSource, false otherwise.
    8. bool MatchCharsInString(const wchar_t * pcszSource, const wchar_t * pcszMatchChars, std::vector<size_t> & index)
    9. {
    10.     std::wstring sSource(pcszSource);
    11.     std::wstring sMatchChars(pcszMatchChars);
    12.     // change input strings to lower case
    13.     std::transform(sSource.begin(), sSource.end(), sSource.begin(), std::tolower);
    14.     std::transform(sMatchChars.begin(), sMatchChars.end(), sMatchChars.begin(), std::tolower);

    15.     bool bFound = true;
    16.     size_t pos = 0;

    17.     std::wstring::iterator itChar = sMatchChars.begin();
    18.     for(itChar; itChar != sMatchChars.end(); itChar++) {
    19.         pos = sSource.find_first_of(*itChar, pos);
    20.         if(pos == std::wstring::npos) {
    21.             // if the position of sSource is the end of the string then
    22.             // there was not a complete match of each character in sMatchChars
    23.             bFound = false;
    24.             break;
    25.         }
    26.         index.push_back(pos);  //push valid position to index
    27.         pos++;
    28.     }
    29.     return bFound;
    30. }
    复制代码
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2021-6-19 14:40
  • 签到天数: 1539 天

    [LV.Master]伴坛终老

     楼主| 发表于 2020-12-28 14:43 | 显示全部楼层
    1. static void ArxDbg_doit(void)
    2.   {
    3.     TCHAR blockName[133];    // buffer for our block name
    4.     AcDbVoidPtrArray ents;   // buffer for holding entities
    5.     AcDbObjectId newBlockId;

    6.     //get an instance of the database
    7.     AcDbDatabase *pDatabase = acdbHostApplicationServices()->workingDatabase();

    8.     //get the name of our new block
    9.     if(acedGetString(1,_T("\nPlease Enter name of new Block: "),blockName) != Acad::eNormal){
    10.       acutPrintf(_T("\nError: Get Block Name Failed: "));
    11.       return;
    12.     }

    13.     //validate the block name
    14.     if(acdbSymUtil()->validateSymbolName(blockName,false) != Acad::eOk){
    15.       acutPrintf(_T("\nError: Symbol %s is invalid: "),blockName);
    16.       return;
    17.     }

    18.     //Open the Block Table using a smart Pointer
    19.     AcDbBlockTablePointer pBlockTable(pDatabase->blockTableId(),AcDb::kForWrite);
    20.     if(pBlockTable.openStatus() != eOk){
    21.       acutPrintf(_T("\nError: Failed to open Block Table: "));
    22.       return;
    23.     }

    24.     //test if our block name already exists
    25.     if(pBlockTable->has(blockName)){
    26.       acutPrintf(_T("\nError: Block Name (%s) Already Exists: "),blockName);
    27.       return;
    28.     }

    29.     //create our block using a smart pointer
    30.     AcDbBlockTableRecordPointer pNewBlockTableRecord;
    31.     pNewBlockTableRecord.create();
    32.     pNewBlockTableRecord->setName(blockName);

    33.     //add the new block to the Block Table
    34.     if(pBlockTable->add(newBlockId,pNewBlockTableRecord)!= Acad::eOk){
    35.       acutPrintf(_T("\nError: Failed to add block (%s): "),blockName);
    36.       return;
    37.     }

    38.     //make a few lines
    39.     SquareOfLines(ents,5);

    40.     //add the lines to our block
    41.     for(size_t i = 0 ; i < ents.length();i++)
    42.     {
    43.       AcDbEntity *pTmp = (AcDbEntity*)ents[i];
    44.       if(pNewBlockTableRecord->appendAcDbEntity(pTmp) != eOk)
    45.         delete pTmp;
    46.       else
    47.         pTmp->close();
    48.     }

    49.     //create a reference of our block
    50.     AcDbObjectPointer<AcDbBlockReference> pNewBlockReference;
    51.     pNewBlockReference.create();
    52.     pNewBlockReference->setPosition(AcGePoint3d::kOrigin);
    53.     pNewBlockReference->setBlockTableRecord(newBlockId);

    54.     //open up the btr of the current space
    55.     AcDbBlockTableRecordPointer pSpace(pDatabase->currentSpaceId(),AcDb::kForWrite);
    56.     if(pSpace.openStatus() != eOk)
    57.     {
    58.       acutPrintf(_T("\nError: Failed to Current Space: "));
    59.       return;
    60.     }

    61.     //add the insert to the current space;
    62.     if(pSpace->appendAcDbEntity(pNewBlockReference) != eOk)
    63.     {
    64.       acutPrintf(_T("\nError: Failed to add Reference: "));
    65.       return;
    66.     }

    67.     //smart pointer do their mojo here.
    68.   }

    69.   static void SquareOfLines(AcDbVoidPtrArray &ents, double size)
    70.   {

    71.     AcGePoint3dArray pts;
    72.     pts.append(AcGePoint3d(-size, -size, 0));
    73.     pts.append(AcGePoint3d(size, -size, 0));
    74.     pts.append(AcGePoint3d(size, size, 0));
    75.     pts.append(AcGePoint3d(-size, size, 0));

    76.     size_t max = pts.length()-1;

    77.     for (size_t i = 0; i <= max; i++)
    78.     {
    79.       int j = (i == max ? 0 : i + 1);
    80.       ents.append(new AcDbLine(pts[i],pts[j]));
    81.     }
    82.   }
    复制代码
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    推荐膜材品牌上一条 /6 下一条

    进口膜材 国产膜材 pvdf膜材ptfe膜材ETFE膜材
    最好的膜结构公司 一级膜结构资质 膜结构一级资质
    膜结构设计-膜结构十大品牌-etfe设计-充气膜结构
    诺科膜结构
    遨都膜结构设计
    中国膜结构网
    中国空间膜结构

    QQ|申请友链|手机版|中国膜结构论坛