반응형
CheckApplyStyleSegment(HC_KEY spaModelSegKye)
{
    char includeSegName[MVO_BUFFER_SIZE];
    char conditionList[MVO_BUFFER_SIZE];
    HC_KEY ref_key; 
    char type[MVO_BUFFER_SIZE];

    HC_Open_Segment_By_Key(spaModelSegKye);
    {
        if(HC_Show_Existence("styles"))
        {
            HC_Begin_Contents_Search(".", "everything");
            {
                while (HC_Find_Contents(type,&ref_key))
                {
                    if(strcmp("style", type)==0)
                    {
                        HC_Open_Segment_By_Key(ref_key);
                        {
                            HC_Show_Conditional_Style(ref_key, includeSegName, conditionList);
                            isContain = true;
                        }
                        HC_Close_Segment();
                    }
                    
                }
            }
            HC_End_Contents_Search();
        }
    }
    HC_Close_Segment();

    return isContain;
}

Segment  Key를 입력 받아서 해당 Segment에 적용되어 있는 Contents를 반복 문으로 호출 하면서 Style관련 Contents만 가져와서

정보를 추출한다.

반응형

public void MakeCylinder
{
	API_BEGIN
	BODY* headCylinder = nullptr;
	BODY* bodyCylinder = nullptr;
	SPAposition centerPosition(20,20,20);
	SPAposition startPosition(0,0,0);
	SPAposition endPosition(100,100,100);
	

	double xdiff = centerPosition.x() - min._x;
	double ydiff = (centerPosition.y() - min._y) + (endPosition.x() - startPosition.x());
	SPAvector traslateVector(-xdiff, -ydiff, 0);
	SPAposition middlePosition(endPosition.x() * 0.05, endPosition.y() , 0);
        
//Rotate 하기위한 Trasf 정보 만들기.
	SPAtransf translateTransf = rotate_transf(degrees_to_radians(azimuthAngle), SPAvector(0, 0, 1)); 
	translateTransf *= translate_transf(traslateVector);

	double HeadRadius = xdiff*0.035;
	double bodyRadius = xdiff*0.012;

	api_solid_cylinder_cone(middlePosition, startPosition, HeadRadius , HeadRadius, 0, nullptr, headCylinder, nullptr);
	api_solid_cylinder_cone(endPosition, middlePosition, bodyRadius , bodyRadius, bodyRadius, nullptr, bodyCylinder, nullptr);

//두 Body를 합치는 함수.
	api_imprint_stitch(headCylinder, bodyCylinder);
	api_transform_entity(headCylinder, translateTransf);
//Transform 적용을 위한 필수 호출 함수
	api_change_body_trans(headCylinder, NULL); 
	rgb_color col(r / 255.0, g / 255.0, b / 255.0);
//Color 변경 함수.
	result = api_rh_set_entity_rgb(headCylinder, col);
	ENTITY_LIST* entityList = spaModeler->GetAllBodies();
	id = entityList->add(headCylinder);
	API_END
}

+ Recent posts