Exemplo n.º 1
0
// Exports the whole configuration as one fused part to an IGES file
void CTiglExportIges::ExportFusedIGES(const std::string& filename)
{
    if (filename.empty()) {
       LOG(ERROR) << "Error: Empty filename in ExportFusedIGES.";
       return;
    }

    PTiglFusePlane fuser = _config.AircraftFusingAlgo();
    fuser->SetResultMode(HALF_PLANE_TRIMMED_FF);
    assert(fuser);

    PNamedShape fusedAirplane = fuser->FusedPlane();
    PNamedShape farField      = fuser->FarField();
    if (!fusedAirplane) {
        throw CTiglError("Error computing fused airplane.", TIGL_NULL_POINTER);
    }

    try {
        ListPNamedShape l;
        l.push_back(fusedAirplane);
        l.push_back(farField);

        // add intersections
        const ListPNamedShape& ints = fuser->Intersections();
        ListPNamedShape::const_iterator it;
        for (it = ints.begin(); it != ints.end(); ++it) {
            l.push_back(*it);
        }

        ExportShapes(l, filename);
    }
    catch (CTiglError&) {
        throw CTiglError("Cannot export fused Airplane as IGES", TIGL_ERROR);
    }
}
void CCPACSWingRibExplicitPositioning::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& explicitRibPosXPath)
{
    Cleanup();

    // Get subelement "startReference"
    char* ptrStartReference = NULL;
    if (tixiGetTextElement(tixiHandle, (explicitRibPosXPath + "/startReference").c_str(), &ptrStartReference) != SUCCESS) {
        LOG(ERROR) << "Missing startReference";
        throw CTiglError("Error: Missing startReference in CCPACSWingRibExplicitPositioning::ReadCPACS!", TIGL_XML_ERROR);
    }
    startReference = ptrStartReference;

    // Get subelement "etaStart"
    ReturnCode tixiRet = tixiGetDoubleElement(tixiHandle, (explicitRibPosXPath + "/etaStart").c_str(), &startEta);
    if (tixiRet != SUCCESS) {
        LOG(ERROR) << "Missing etaStart";
        throw CTiglError("Error: Missing etaStart in CCPACSWingRibExplicitPositioning::ReadCPACS!", TIGL_XML_ERROR);
    }

    // Get subelement "endReference"
    char* ptrEndReference = NULL;
    if (tixiGetTextElement(tixiHandle, (explicitRibPosXPath + "/endReference").c_str(), &ptrEndReference) != SUCCESS) {
        LOG(ERROR) << "Missing endReference";
        throw CTiglError("Error: Missing endReference in CCPACSWingRibExplicitPositioning::ReadCPACS!", TIGL_XML_ERROR);
    }
    endReference = ptrEndReference;

    // Get subelement "etaEnd"
    tixiRet = tixiGetDoubleElement(tixiHandle, (explicitRibPosXPath + "/etaEnd").c_str(), &endEta);
    if (tixiRet != SUCCESS) {
        LOG(ERROR) << "Missing etaEnd";
        throw CTiglError("Error: Missing etaEnd in CCPACSWingRibExplicitPositioning::ReadCPACS!", TIGL_XML_ERROR);
    }
}
void CCPACSWingCellPositionChordwise::ReadCPACS(TixiDocumentHandle tixiHandle,  const std::string& xpath)
{
    Reset();

    // Get subelement "xsi1, xsi2" or Spar Uid (choice)
    const std::string sparUIdString  = xpath + "/sparUID";
    const std::string xsi1String     = xpath + "/xsi1";

    if (tixiCheckElement(tixiHandle, xsi1String.c_str()) == SUCCESS) {
        m_inputType = Xsi;
        if (tixiGetDoubleElement(tixiHandle, xsi1String.c_str(), &m_xsi1) != SUCCESS) {
            LOG(ERROR) << "Error during read of <xsi1>";
            throw CTiglError("Error: Error during read of <xsi1> in CCPACSWingCellPositionChordwise::ReadCPACS!", TIGL_XML_ERROR);
        }
        if (tixiGetDoubleElement(tixiHandle, (xpath + "/xsi2").c_str(), &m_xsi2) != SUCCESS) {
            LOG(ERROR) << "Error during read of <xsi2>";
            throw CTiglError("Error: Error during read of <xsi2> in CCPACSWingCellPositionChordwise::ReadCPACS!", TIGL_XML_ERROR);
        }
    }
    else if (tixiCheckElement(tixiHandle, sparUIdString.c_str()) == SUCCESS) {
        m_inputType = Spar;
        char* ptrSUId = NULL;
        if (tixiGetTextElement(tixiHandle, sparUIdString.c_str(), &ptrSUId) != SUCCESS) {
            LOG(ERROR) << "Error during read of <sparUID>";
            throw CTiglError("Error: Error during read of <sparUID> in CCPACSWingCellPositionChordwise::ReadCPACS!", TIGL_XML_ERROR);
        }
        m_sparUID = ptrSUId;

    }
    else {
        LOG(ERROR) << "Missing element <xsi1> or <sparUID>";
        throw CTiglError("Error: Missing element <xsi1> or <sparUID> in CCPACSWingCellPositionChordwise::ReadCPACS!", TIGL_XML_ERROR);
    }
}
Exemplo n.º 4
0
// Returns a pointer to the geometric component for the given unique id.
CTiglAbstractPhysicalComponent* CTiglUIDManager::GetPhysicalComponent(const std::string& uid)
{
    if (uid.empty()) {
        throw CTiglError("Empty UID in CTiglUIDManager::GetComponent", TIGL_XML_ERROR);
    }

    if (physicalShapes.find(uid) == physicalShapes.end()) {
        throw CTiglError("UID not found in CTiglUIDManager::GetComponent", TIGL_XML_ERROR);
    }

    return physicalShapes[uid];
}
CCPACSFuselageProfileGetPointAlgo::CCPACSFuselageProfileGetPointAlgo (const TopTools_SequenceOfShape& wireContainer)
{
    try {
        if (wireContainer.Length()!=1) {
            throw CTiglError("Error: CCPACSWingProfileGetPointAlgo: Number of wires is not equal 1", TIGL_ERROR);
        }
        wire = TopoDS::Wire(wireContainer(1));
    }
    catch(...) {
        throw CTiglError("Error: CCPACSFuselageProfileGetPointAlgo: Conversion of shape to wire failed", TIGL_ERROR);
    }
    wireLength = GetWireLength(wire);
}
Exemplo n.º 6
0
// Returns a pointer to the geometric component for the given unique id.
ITiglGeometricComponent* CTiglUIDManager::GetComponent(const std::string& uid)
{
    if (uid.empty()) {
        throw CTiglError("Empty UID in CTiglUIDManager::GetComponent", TIGL_UID_ERROR);
    }

    if (!HasUID(uid)) {
        std::stringstream stream;
        stream << "UID " << uid << " not found in CTiglUIDManager::GetComponent";
        throw CTiglError(stream.str(), TIGL_UID_ERROR);
    }

    return allShapes[uid];
}
// Read CPACS fuselage section elements
void CCPACSFuselageSectionElements::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& sectionXPath)
{
    Cleanup();

    ReturnCode    tixiRet;
    int           elementCount;
    std::string   tempString;
    char*         elementPath;

    /* Get section element count */
    tempString  = sectionXPath + "/elements";
    elementPath = const_cast<char*>(tempString.c_str());
    tixiRet = tixiGetNamedChildrenCount(tixiHandle, elementPath, "element", &elementCount);
    if (tixiRet != SUCCESS) {
        throw CTiglError("XML error: tixiGetNamedChildrenCount failed in CCPACSFuselageSectionElements::ReadCPACS", TIGL_XML_ERROR);
    }

    // Loop over all section elements
    for (int i = 1; i <= elementCount; i++) {
        CCPACSFuselageSectionElement* element = new CCPACSFuselageSectionElement();
        elements.push_back(element);

        tempString = sectionXPath + "/elements/element[";
        std::ostringstream xpath;
        xpath << tempString << i << "]";
        element->ReadCPACS(tixiHandle, xpath.str());
    }
}
Exemplo n.º 8
0
// Read CPACS section elements
void CCPACSFuselageConnection::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& connectionXPath)
{
    Cleanup();

    char*       elementPath;
    std::string tempString;

    // Get subelement "element"
    char* ptrElementUID = NULL;
    tempString    = connectionXPath;
    elementPath   = const_cast<char*>(tempString.c_str());
    if (tixiGetTextElement(tixiHandle, elementPath, &ptrElementUID) != SUCCESS) {
        throw CTiglError("Error: Can't read element <element/> in CCPACSFuselageConnection::ReadCPACS", TIGL_XML_ERROR);
    }
    elementUID = ptrElementUID;

    // find the corresponding section to this segment
    CCPACSFuselage& fuselage = segment->GetFuselage();
    for (int i=1; i <= fuselage.GetSectionCount(); i++) {
        CCPACSFuselageSection& section = fuselage.GetSection(i);
        for (int j=1; j <= section.GetSectionElementCount(); j++) {
            if (section.GetSectionElement(j).GetUID() == elementUID ) {
                sectionUID = section.GetUID();
                sectionIndex = i;
                elementIndex = j;
            }
        }
    }
}
std::pair<double, double> CCPACSWingCellPositionChordwise::GetXsi() const
{
    if (m_inputType != Xsi) {
        throw CTiglError("CCPACSWingCellPositionChordwise::GetXsi method called, but position is defined via sparUID!");
    }
    return std::make_pair(m_xsi1, m_xsi2);
}
Exemplo n.º 10
0
const std::string& CCPACSWingCellPositionChordwise::GetSparUId() const
{
    if (m_inputType != Spar) {
        throw CTiglError("CCPACSWingCellPositionChordwise::GetSparUId method called, but position is defined via xsi1/xsi2!");
    }
    return m_sparUID;
}
void CCPACSControlSurfaceDeviceAirfoil::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& xpath)
{
    char* tmp = NULL;

    if (tixiGetTextElement(tixiHandle, (xpath + "/airfoilUID").c_str(), &tmp) == SUCCESS) {
        _airfoilUID = tmp;

        // check if airfoil exists by query
        _config->GetWingProfile(_airfoilUID);
    }
    else {
        throw CTiglError("Missing airfoilUID element in path: " + xpath + "!", TIGL_OPEN_FAILED);
    }

    _rotX = 90.0;
    if (tixiCheckElement(tixiHandle, (xpath + "/rotX").c_str()) == SUCCESS) {
        tixiGetDoubleElement(tixiHandle, (xpath + "/rotX").c_str(), &_rotX);
    }

    // check, if yscale != 1. If yes, we show a warning
    double scalY;
    if (tixiCheckElement(tixiHandle, (xpath + "/scalY").c_str()) == SUCCESS) {
        tixiGetDoubleElement(tixiHandle, (xpath + "/scalY").c_str(), &scalY);
        if (fabs(scalY - 1.0) > 1e-10) {
            LOG(WARNING) << "Y scaling in \"" << xpath << "\" ignored. Only 2D profiles supported.";
        }
    }

    _scalZ = 1.0;
    if (tixiCheckElement(tixiHandle, (xpath + "/scalZ").c_str()) == SUCCESS) {
        tixiGetDoubleElement(tixiHandle, (xpath + "/scalZ").c_str(), &_scalZ);
    }
}
Exemplo n.º 12
0
// Read CPACS positionings element
void CCPACSWingPositionings::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& wingXPath)
{
    Cleanup();

    ReturnCode    tixiRet;
    int           positioningCount;
    std::string   tempString;
    char*         elementPath;

    /* Get positioning element count */
    tempString  = wingXPath + "/positionings";
    elementPath = const_cast<char*>(tempString.c_str());
    tixiRet = tixiGetNamedChildrenCount(tixiHandle, elementPath, "positioning", &positioningCount);
    if (tixiRet != SUCCESS) {
        throw CTiglError("XML error: tixiGetNamedChildrenCount failed in CCPACSWingPositionings::ReadCPACS", TIGL_XML_ERROR);
    }

    // Loop over all positionings
    for (int i = 1; i <= positioningCount; i++) {
        CCPACSWingPositioning* positioning = new CCPACSWingPositioning();

        tempString = wingXPath + "/positionings/positioning[";
        std::ostringstream xpath;
        xpath << tempString << i << "]";
        positioning->ReadCPACS(tixiHandle, xpath.str());
        
        positionings[positioning->GetOuterSectionIndex()] = positioning;
    }

    Update();
}
Exemplo n.º 13
0
gp_Pnt getSectionElementChordlinePoint(const CCPACSWingComponentSegment& cs, const std::string& sectionElementUID, double xsi)
{
    gp_Pnt chordlinePoint;
    CCPACSWing& wing = cs.GetWing();
    // find section element
    const CCPACSWingSegment& segment = static_cast<const CCPACSWingSegment&>(wing.GetSegment(1));
    if (sectionElementUID == segment.GetInnerSectionElementUID()) {
        // convert into wing coordinate system
        CTiglTransformation wingTrans = wing.GetTransformation();
        chordlinePoint = wingTrans.Inverted().Transform(segment.GetChordPoint(0, xsi));
    }
    else {
        int i;
        for (i = 1; i <= wing.GetSegmentCount(); ++i) {
            const CCPACSWingSegment& segment = static_cast<const CCPACSWingSegment&>(wing.GetSegment(i));
            if (sectionElementUID == segment.GetOuterSectionElementUID()) {
                // convert into wing coordinate system
                CTiglTransformation wingTrans = wing.GetTransformation();
                chordlinePoint = wingTrans.Inverted().Transform(segment.GetChordPoint(1, xsi));
                break;
            }
        }
        if (i > wing.GetSegmentCount()) {
            throw CTiglError("Error in getSectionElementChordlinePoint: section element not found!");
        }
    }
    return chordlinePoint;
}
Exemplo n.º 14
0
double computeRibEtaValue(const CTiglWingStructureReference& wsr, const CCPACSWingRibsDefinition& rib, int ribIndex, double xsi)
{
    // determine rib start and ent point
    gp_Pnt ribStartPoint, ribEndPoint;
    rib.GetRibMidplanePoints(ribIndex, ribStartPoint, ribEndPoint);

    double startEta, startXsi, endEta, endXsi;
    wsr.GetMidplaneEtaXsi(ribStartPoint, startEta, startXsi);
    wsr.GetMidplaneEtaXsi(ribEndPoint, endEta, endXsi);

    // fix numeric inaccuracy in xsi
    double precision = 1.E-8;
    if (xsi < startXsi && xsi >= (startXsi - precision)) {
        xsi = startXsi;
    }
    else if (xsi > endXsi && xsi <= (endXsi + precision)) {
        xsi = endXsi;
    }

    if (xsi < startXsi || xsi > endXsi) {
        throw CTiglError("Error in computeRibEtaValue: rib is not defined at passed xsi coordinate!");
    }

    // NOTE: may not be fully correct when rib lies within more than 1 segment!
    return startEta + (endEta - startEta) * ((xsi - startXsi) / (endXsi - startXsi));
}
Exemplo n.º 15
0
// Read CPACS wing sections element
void CCPACSWingSections::ReadCPACS(TixiDocumentHandle tixiHandle, const std::string& wingXPath)
{
    Cleanup();

    ReturnCode    tixiRet;
    int           sectionCount;
    std::string   tempString;
    char*         elementPath;

    /* Get section element count */
    tempString  = wingXPath + "/sections";
    elementPath = const_cast<char*>(tempString.c_str());
    tixiRet = tixiGetNamedChildrenCount(tixiHandle, elementPath, "section", &sectionCount);
    if (tixiRet != SUCCESS) {
        throw CTiglError("XML error: tixiGetNamedChildrenCount failed in CCPACSWingSections::ReadCPACS", TIGL_XML_ERROR);
    }

    // Loop over all sections
    for (int i = 1; i <= sectionCount; i++) {
        CCPACSWingSection* section = new CCPACSWingSection();
        sections.push_back(section);

        tempString = wingXPath + "/sections/section[";
        std::ostringstream xpath;
        xpath << tempString << i << "]";
        section->ReadCPACS(tixiHandle, xpath.str());
    }
}
Exemplo n.º 16
0
// Returns the wing for a given index.
CCPACSWing& CCPACSWings::GetWing(int index) const
{
    index --;
    if (index < 0 || index >= GetWingCount()) {
        throw CTiglError("Error: Invalid index in CCPACSWings::GetWing", TIGL_INDEX_ERROR);
    }
    return (*wings[index]);
}
Exemplo n.º 17
0
bool CCPACSWingProfile::HasBluntTE() const
{
    PTiglWingProfileAlgo algo = GetProfileAlgo();
    if (!algo) {
        throw CTiglError("No wing profile algorithm regsitered in CCPACSWingProfile::HasBluntTE()!");
    }
    return algo->HasBluntTE();
}
Exemplo n.º 18
0
// Returns the section for a given index
CCPACSWingSection& CCPACSWingSections::GetSection(int index) const
{
    index--;
    if (index < 0 || index >= GetSectionCount()) {
        throw CTiglError("Error: Invalid index in CCPACSWingSections::GetSection", TIGL_INDEX_ERROR);
    }
    return (*sections[index]);
}
// Get element for a given index
CCPACSFuselageSectionElement& CCPACSFuselageSectionElements::GetSectionElement(int index) const
{
    index--;
    if (index < 0 || index >= GetSectionElementCount()) {
        throw CTiglError("Error: Invalid index in CCPACSFuselageSectionElements::GetSectionElement", TIGL_INDEX_ERROR);
    }
    return (*elements[index]);
}
Exemplo n.º 20
0
// Checks if a UID already exists.
bool CTiglUIDManager::HasUID(const std::string& uid) const
{
    if (uid.empty()) {
        throw CTiglError("Empty UID in CTiglUIDManager::HasUID", TIGL_XML_ERROR);
    }

    return (allShapes.find(uid) != allShapes.end());
}
Exemplo n.º 21
0
// Sets a value of the transformation matrix by row/col
void CTiglTransformation::SetValue(int row, int col, double value)
{
    if (row < 0 || row > 3 || col < 0 || col > 3) {
        throw CTiglError("Error: Invalid row or column index in CTiglTransformation::SetValue", TIGL_INDEX_ERROR);
    }

    m_matrix[row][col] = value;
}
Exemplo n.º 22
0
CTiglFileLogger::CTiglFileLogger(FILE * file) : logFileStream(file), mutex(new CMutex), verbosity(TILOG_DEBUG4)
{
    if (!logFileStream) {
        throw CTiglError("Null pointer for argument file in CTiglLogFile", TIGL_NULL_POINTER);
    }
    
    fileOpened = false;
}
Exemplo n.º 23
0
// Returns the rotor hinge for a given index.
CCPACSRotorHinge& CCPACSRotorHinges::GetRotorHinge(int index) const
{
    index--;
    if (index < 0 || index >= GetRotorHingeCount()) {
        throw CTiglError("Error: Invalid index in CCPACSRotorHinges::GetRotorHinge", TIGL_INDEX_ERROR);
    }
    return (*rotorHinges[index]);
}
Exemplo n.º 24
0
CCPACSWingSparSegment& CCPACSWingSparSegments::GetSparSegment(int index) const
{
    const int idx = index - 1;
    if (idx < 0 || idx >= GetSparSegmentCount()) {
        LOG(ERROR) << "Invalid index value";
        throw CTiglError("Error: Invalid index value in CCPACSWingSparSegments::getSparSegment", TIGL_INDEX_ERROR);
    }
    return (*(sparSegments[idx]));
}
Exemplo n.º 25
0
// Returns the wing profile for a given uid.
CCPACSWingProfile& CCPACSWingProfiles::GetProfile(std::string uid) const
{
    CCPACSWingProfileContainer::const_iterator it = profiles.find(uid);
    if (it != profiles.end() && it->second) {
        return *(it->second);
    }
    else {
        throw CTiglError("Wing profile \"" + uid + "\" not found in CPACS file!", TIGL_UID_ERROR);
    }
}
Exemplo n.º 26
0
void CTiglControlSurfaceHingeLine::buildHingeLine() const
{
    if (!_invalidated) {
        return;
    }
    
    if (!_segment || !_path || !_outerShape) {
        throw CTiglError("Null pointer in CTiglControlSurfaceHingeLine::buildHingeLine!", TIGL_NULL_POINTER);
    }
    
    // Calculate inner and outer HingePoint
    for ( int borderCounter = 0; borderCounter < 2; borderCounter++ ) {
        const CCPACSControlSurfaceDeviceOuterShapeBorder* border = NULL;
        double hingeXsi;
        if (borderCounter == 0) {
            border = &_outerShape->getOuterBorder();
            hingeXsi = _path->getOuterHingePoint().getXsi();
        }
        else {
            border = &_outerShape->getInnerBorder();
            hingeXsi = _path->getInnerHingePoint().getXsi();
        }

        double borderEtaLE = border->getEtaLE();
        double borderEtaTE = border->getEtaTE();
        double hingeEta = -1;

        // only calculate etaCoordinate if it´s not the same as the other one.
        if ( fabs(borderEtaLE - borderEtaTE) < 0.0001 ) {
            hingeEta = (borderEtaTE + borderEtaLE)/2;
        }
        else {
            double m = ( borderEtaLE - borderEtaTE )/(border->getXsiLE() - border->getXsiTE());
            hingeEta = m * (hingeXsi - border->getXsiLE()) + borderEtaLE;
        }

        double eta = 0.,xsi = 0.;
        CCPACSWingSegment* wsegment = _segment->GetSegmentEtaXsi(hingeEta,hingeXsi,eta,xsi);
        gp_Pnt hingeUpper = wsegment->GetUpperPoint(eta,xsi);
        gp_Pnt hingeLower = wsegment->GetLowerPoint(eta,xsi);

        if (borderCounter == 0) {
            double relHeight = _path->getOuterHingePoint().getRelHeight();
            gp_Vec upperToLower = (gp_Vec(hingeLower.XYZ()) - gp_Vec(hingeUpper.XYZ())).Multiplied(relHeight);
            _outerHingePoint = gp_Pnt(( gp_Vec(hingeUpper.XYZ()) + gp_Vec(upperToLower.XYZ() )).XYZ());
        }
        else {
            double relHeight = _path->getInnerHingePoint().getRelHeight();
            gp_Vec upperToLower = (gp_Vec(hingeLower.XYZ()) - gp_Vec(hingeUpper.XYZ())).Multiplied(relHeight);
            _innerHingePoint = gp_Pnt(( gp_Vec(hingeUpper.XYZ()) + gp_Vec(upperToLower.XYZ() )).XYZ());
        }
    }
    
    _invalidated = false;
}
Exemplo n.º 27
0
/**
 * @briefAdds a shape to the IGES file. All faces are named according to their face
 * traits. If there are no faces, the wires are named according to the shape name.
 * 
 * The level parameter defines the iges layer/level, which is another way of grouping faces.
 */
void CTiglExportIges::AddToIges(PNamedShape shape, IGESControl_Writer& writer, int level) const 
{
    if (!shape) {
        return;
    }
    
    std::string shapeName = shape->Name();
    std::string shapeShortName = shape->ShortName();
    Handle(Transfer_FinderProcess) FP = writer.TransferProcess();
    TopTools_IndexedMapOfShape faceMap;
    TopExp::MapShapes(shape->Shape(),   TopAbs_FACE, faceMap);
    // any faces?
    if (faceMap.Extent() > 0) {
        int ret = writer.AddShape(shape->Shape());
        if (ret > IFSelect_RetDone) {
            throw CTiglError("Error: Export to IGES file failed in CTiglExportStep. Could not translate shape " 
                             + shapeName + " to iges entity,", TIGL_ERROR);
        }
        WriteIgesNames(FP, shape, level);
    }
    else {
        // no faces, export edges as wires
        Handle(TopTools_HSequenceOfShape) Edges = new TopTools_HSequenceOfShape();
        TopExp_Explorer myEdgeExplorer (shape->Shape(), TopAbs_EDGE);
        while (myEdgeExplorer.More()) {
            Edges->Append(TopoDS::Edge(myEdgeExplorer.Current()));
            myEdgeExplorer.Next();
        }
        ShapeAnalysis_FreeBounds::ConnectEdgesToWires(Edges, 1e-7, false, Edges);
        for (int iwire = 1; iwire <= Edges->Length(); ++iwire) {
            int ret = writer.AddShape(Edges->Value(iwire));
            if (ret > IFSelect_RetDone) {
                throw CTiglError("Error: Export to IGES file failed in CTiglExportIges. Could not translate shape " 
                                 + shapeName + " to iges entity,", TIGL_ERROR);
            }
            PNamedShape theWire(new CNamedShape(Edges->Value(iwire),shapeName.c_str()));
            theWire->SetShortName(shapeShortName.c_str());
            WriteIGESShapeNames(FP, theWire, level);
            WriteIgesWireName(FP, theWire);
        }
    }
}
Exemplo n.º 28
0
// Returns the guide curve for a given uid.
CCPACSGuideCurveProfile& CCPACSGuideCurveProfiles::GetGuideCurveProfile(std::string uid) const
{
    CCPACSGuideCurveProfileContainer::const_iterator it = guideCurves.find(uid);
    if (it != guideCurves.end() && it->second) {
        return *(it->second);
    }
    else {
        LOG(ERROR) << "Guide curve \"" + uid + "\" not found in CPACS file!" << endl;
        throw CTiglError("Guide curve \"" + uid + "\" not found in CPACS file!", TIGL_UID_ERROR);
    }
}
Exemplo n.º 29
0
// Function to add a UID and a geometric component to the uid store.
void CTiglUIDManager::AddUID(const std::string& uid, ITiglGeometricComponent* componentPtr)
{
    if (uid.empty()) {
        throw CTiglError("Empty UID in CTiglUIDManager::AddUID", TIGL_XML_ERROR);
    }

    if (HasUID(uid)) {
        throw CTiglError("Duplicate UID " + uid + " in CPACS file (CTiglUIDManager::AddUID)", TIGL_XML_ERROR);
    }

    if (componentPtr == 0) {
        throw CTiglError("Null pointer for component in CTiglUIDManager::AddUID", TIGL_NULL_POINTER);
    }

    CTiglAbstractPhysicalComponent* tmp = dynamic_cast<CTiglAbstractPhysicalComponent*>(componentPtr);
    if (tmp && (componentPtr->GetComponentType() | TIGL_COMPONENT_PHYSICAL) ) {
        physicalShapes[uid] = tmp;
    }
    allShapes[uid] = componentPtr;
    invalidated = true;
}
Exemplo n.º 30
0
double computeSparXsiValue(const CTiglWingStructureReference& wsr, const CCPACSWingSparSegment& spar, double eta)
{
    TopoDS_Wire sparMidplaneLine = spar.GetSparMidplaneLine();
    TopoDS_Face etaCutFace = buildEtaCutFace(wsr, eta);
    gp_Pnt etaXsiPoint;
    if (!GetIntersectionPoint(etaCutFace, sparMidplaneLine, etaXsiPoint)) {
        throw CTiglError("Error in computation of spar eta point in tigletaxsifunctions::computeSparXsiValue");
    }
    double newEta, xsi;
    wsr.GetMidplaneEtaXsi(etaXsiPoint, newEta, xsi);
    return xsi;
}