2013-10-10 4 views
1

룸 질량을 개념 질량으로 변환하는 Autodesk Revit 2014 용 플러그인 작업 중입니다. 하지만 스크립트를 실행하면 revit이 완전히 종료됩니다. 나는 충돌을 일으키는 코드를 격리했습니다Autodesk Revit 플러그인이 손상됨

Extrusion m_Extrusion = m_FamDoc.FamilyCreate.NewExtrusion(true, m_CurveArArray, m_SketchPlane, 8); 

그리고 REVIT 로그가이 오류를 보여

DBG_INFO: Detected unfrozen change of selection.: line 571 of n:\build\2014_ship_x64_inst_20130308_1515\source\revit\revitui\modscope\ModScope.cpp

압출 명령을 내 사용에 문제가있는 경우

사람이 알고 있나요? 아니면 Revit에서 뭔가 있습니까?

미리 감사드립니다.

내 자신의 압출 코드를 생성 한 NOT 및 B. 당신이 무슨 일을하는지의 큰 맥락을 이해하지

답변

-1

A.,

내 최고의 제안이 책을 마스터 링 된 Revit 건축 2014을 확인하는 것입니다 지금 당장 2013 년 도서를보고 있는데 API에 대한 섹션이 있습니다 (25 장). 그 장에서, 그들은 공간을 차지하고 대중을 생성하는 addin에 대해 깊이 들어가 있습니다. 그것은 당신이 찾고있는 정확히 것 같습니다.

API 참조가 2014 년 책에 포함되어 있는지, TOC에 나열되어 있지 않은지 확인하기 위해 방금 돌아 보았습니다. 따라서 해당 버전이 운이 좋지 않을 수 있습니다. 그것),하지만 2013 확실히 않습니다.

http://www.wiley.com/WileyCDA/WileyTitle/productCd-1118174089.html

+1

SO! 도서 추천은 유감스럽게도 여기에별로 도움이되지 않습니다. 책에서 답을 얻으면 책에 대한 크레디트를 얻을 수 있지만, OP에는 책을 구할 수있는 리소스가 없을 수도 있습니다. OP의 영역에서 사용할 수 없거나 책이 절판되면 어떻게됩니까? 답변에 샘플 코드를 제공 할 수 있다면 OP가 훨씬 더 도움이 될 것입니다. – Derek

+0

감사합니다 @Derek. 나는 너에게 정신적으로 동의한다. 아무도 3 주 만에이 대답을 만진 적이 없었습니다. 한 줄의 코드를 사용하여 사용자의 의도와 동일한 API 샘플에 대한 책 참조를 검토합니다. –

0

당신은 이것에 대한 트랜잭션을 창조 하셨 는가? 다음과 같습니다 : using (Transaction trans = new Transaction (doc, "Extrude")) { trans.Start(); 돌출 m_extrusion = m_FamDoc.FamilyCreate.NewExtrusion ...... trans.Commit(); }

1

그것은 이상한 완전히 ...이

는 사실, createSolid 메서드를 참조하십시오이 방법을 주위에 전체 샘플이합니다 (NewExtrusion 호출하기 전에) 코드에 관련이있을 수 있습니다 동결 (라인 170 정도) github의이 파일에서 : https://github.com/ADN-DevTech/RevitTrainingMaterial/blob/master/Labs/3_Revit_Family_API/SourceCS/1_ColumnRectangle.cs :

// ========================================== 
    // (1) create a simple solid by extrusion 
    // ========================================== 
    Extrusion createSolid() 
    { 
     // 
     // (1) define a simple rectangular profile 
     // 
     // 3  2 
     // +---+ 
     // | | d h = height 
     // +---+ 
     // 0  1 
     // 4 w 
     // 
     CurveArrArray pProfile = createProfileRectangle(); 
     // 
     // (2) create a sketch plane 
     // 
     // we need to know the template. If you look at the template (Metric Column.rft) and "Front" view, 
     // you will see "Reference Plane" at "Lower Ref. Level". We are going to create an extrusion there. 
     // findElement() is a helper function that find an element of the given type and name. see below. 
     // 
     ReferencePlane pRefPlane = findElement(typeof(ReferencePlane), "Reference Plane") as ReferencePlane; 
     //SketchPlane pSketchPlane = _doc.FamilyCreate.NewSketchPlane(pRefPlane.Plane); // 2013 
     SketchPlane pSketchPlane = SketchPlane.Create(_doc, pRefPlane.Plane); // 2014 

     // (3) height of the extrusion 
     // 
     // once again, you will need to know your template. unlike UI, the alightment will not adjust the geometry. 
     // You will need to have the exact location in order to set alignment. 
     // Here we hard code for simplicity. 4000 is the distance between Lower and Upper Ref. Level. 
     // as an exercise, try changing those values and see how it behaves. 
     // 
     double dHeight = mmToFeet(4000.0); 

     // (4) create an extrusion here. at this point. just an box, nothing else. 
     // 
     bool bIsSolid = true; 
     return _doc.FamilyCreate.NewExtrusion(bIsSolid, pProfile, pSketchPlane, dHeight); 
    }