Ejemplo n.º 1
0
RH_C_FUNCTION bool ON_Object_SetUserString(const ON_Object* pObject, const RHMONO_STRING* _key, const RHMONO_STRING* _value)
{
  bool rc = false;
  if( pObject && _key )
  {
    ON_Object* ptr = const_cast<ON_Object*>(pObject);
    INPUTSTRINGCOERCE(key, _key);
    INPUTSTRINGCOERCE(value, _value);
    rc = ptr->SetUserString(key, value);
#if defined(RHINO_V5SR) // only available in V5
    RhUpdateTextFieldSerialNumber();
#endif
  }
  return rc;
}
Ejemplo n.º 2
0
RH_C_FUNCTION void ON_3dmObjectAttributes_GetSetString(ON_3dmObjectAttributes* ptr, int which, bool set, const RHMONO_STRING* _str, CRhCmnStringHolder* pStringHolder)
{
  INPUTSTRINGCOERCE(str, _str);
  const int idxName = 0;
  const int idxUrl = 1;
  if( ptr )
  {
    if(set)
    {
      if( idxName == which )
        ptr->m_name = str;
      else if( idxUrl == which )
        ptr->m_url = str;
    }
    else
    {
      if( pStringHolder )
      {
        if( idxName == which )
          pStringHolder->Set( ptr->m_name );
        else if( idxUrl == which )
          pStringHolder->Set( ptr->m_url );
      }
    }
  }
}
Ejemplo n.º 3
0
RH_C_FUNCTION void ON_Annotation2_Text(ON_Annotation2* pAnnotation2, CRhCmnStringHolder* pStringHolder, const RHMONO_STRING* _str, bool formula)
{
  if( pAnnotation2 )
  {
    if( _str )
    {
      INPUTSTRINGCOERCE(str, _str);
      if( formula )
      {
        pAnnotation2->SetTextFormula(str);
        pAnnotation2->SetTextValue(NULL);
      }
      else
      {
        pAnnotation2->SetTextValue(str);
        pAnnotation2->SetTextFormula(NULL);
      }
    }

    if( pStringHolder )
    {
      if( formula )
        pStringHolder->Set( pAnnotation2->TextFormula() );
      else
        pStringHolder->Set( pAnnotation2->TextValue() );
    }
  }
}
Ejemplo n.º 4
0
RH_C_FUNCTION const wchar_t* ON_Annotation2_Text(ON_Annotation2* pAnnotation2, const RHMONO_STRING* _str, bool formula)
{
  const wchar_t* rc = NULL;
  if( pAnnotation2 )
  {
    if( _str )
    {
      INPUTSTRINGCOERCE(str, _str);
#if defined(RHINO_V5SR) || defined(OPENNURBS_BUILD)// only available in V5
      if( formula )
      {
        pAnnotation2->SetTextFormula(str);
        pAnnotation2->SetTextValue(NULL);
      }
      else
      {
        pAnnotation2->SetTextValue(str);
        pAnnotation2->SetTextFormula(NULL);
      }
#else
      pAnnotation2->SetUserText(str);
#endif
    }

#if defined(RHINO_V5SR) || defined(OPENNURBS_BUILD)// only available in V5
    if( formula )
      rc = pAnnotation2->TextFormula();
    else
      rc = pAnnotation2->TextValue();
#else
    rc = pAnnotation2->UserText();
#endif
  }
  return rc;
}
Ejemplo n.º 5
0
RH_C_FUNCTION void ON_StringArray_Append(ON_ClassArray<ON_wString>* pStrings, const RHMONO_STRING* str)
{
  if( pStrings && str )
  {
    INPUTSTRINGCOERCE(_str, str);
    pStrings->Append(_str);
  }
}
Ejemplo n.º 6
0
RH_C_FUNCTION void ON_wString_Set(ON_wString* pString, const RHMONO_STRING* _text)
{
  if( pString )
  {
    INPUTSTRINGCOERCE(text, _text);
    (*pString) = text;
  }
}
Ejemplo n.º 7
0
RH_C_FUNCTION ON_wString* ON_wString_New(const RHMONO_STRING* _text)
{
  INPUTSTRINGCOERCE(text, _text);
  if( text )
    return new ON_wString(text);
  
  return new ON_wString();
}
Ejemplo n.º 8
0
RH_C_FUNCTION void ON_TextLog_Print(ON_TextLog* pTextLog, const RHMONO_STRING* _text)
{
  if( pTextLog )
  {
    INPUTSTRINGCOERCE(text, _text);
    pTextLog->Print(text);
  }
}
Ejemplo n.º 9
0
RH_C_FUNCTION void ON_TextDot_SetFontFace(ON_TextDot* pDot, const RHMONO_STRING* face)
{
  if( pDot && face )
  {
    INPUTSTRINGCOERCE(_face, face);
    pDot->SetFontFace(_face);
  }
}
Ejemplo n.º 10
0
RH_C_FUNCTION void ON_Material_SetName(ON_Material* pMaterial, const RHMONO_STRING* name)
{
  if( pMaterial )
  {
    INPUTSTRINGCOERCE(_name, name);
    pMaterial->m_material_name = _name;
  }
}
Ejemplo n.º 11
0
RH_C_FUNCTION void ON_Light_SetName(ON_Light* pLight, const RHMONO_STRING* pString)
{
  if( pLight )
  {
    INPUTSTRINGCOERCE(_str, pString);
    pLight->SetLightName(_str);
  }
}
Ejemplo n.º 12
0
RH_C_FUNCTION void ON_Texture_SetFileName(ON_Texture* pTexture, const RHMONO_STRING* filename)
{
  if( pTexture )
  {
    INPUTSTRINGCOERCE(_filename, filename);
    pTexture->m_filename = _filename;
  }
}
Ejemplo n.º 13
0
RH_C_FUNCTION void ON_Material_SetBitmapTexture(ON_Material* pMaterial, int index, const RHMONO_STRING* filename)
{
  INPUTSTRINGCOERCE(_filename, filename);
  if( pMaterial && index>=0 && index<pMaterial->m_textures.Count())
  {
    pMaterial->m_textures[index].m_filename = _filename;
  }
}
Ejemplo n.º 14
0
RH_C_FUNCTION void ON_TextLog_PrintWrappedText(ON_TextLog* pTextLog, const RHMONO_STRING* _text, int line_length)
{
  if( pTextLog )
  {
    INPUTSTRINGCOERCE(text, _text);
    pTextLog->PrintWrappedText(text, line_length);
  }
}
Ejemplo n.º 15
0
RH_C_FUNCTION void ON_Linetype_SetLinetypeName(ON_Linetype* pLinetype, const RHMONO_STRING* _name)
{
  INPUTSTRINGCOERCE(name, _name);
  if( pLinetype )
  {
    pLinetype->SetLinetypeName(name);
  }
}
Ejemplo n.º 16
0
RH_C_FUNCTION void ON_DimStyle_SetName(ON_DimStyle* pDimStyle, const RHMONO_STRING* _name)
{
  INPUTSTRINGCOERCE(name, _name);
  if( pDimStyle )
  {
    pDimStyle->SetName(name);
  }
}
Ejemplo n.º 17
0
RH_C_FUNCTION ON_TextDot* ON_TextDot_New(const RHMONO_STRING* _str, ON_3DPOINT_STRUCT loc)
{
  INPUTSTRINGCOERCE(str, _str);
  ON_TextDot* ptr = new ON_TextDot();
  ptr->SetTextString(str);
  const ON_3dPoint* _loc = (const ON_3dPoint*)&loc;
  ptr->SetPoint(*_loc);
  return ptr;
}
Ejemplo n.º 18
0
RH_C_FUNCTION int ON_Material_AddTransparencyTexture(ON_Material* pMaterial, const RHMONO_STRING* filename)
{
  int rc = -1;
  INPUTSTRINGCOERCE(_filename, filename);
  if( pMaterial && _filename)
  {
    rc = pMaterial->AddTexture(_filename, ON_Texture::transparency_texture);
  }
  return rc;
}
Ejemplo n.º 19
0
RH_C_FUNCTION int ON_Material_AddEnvironmentTexture(ON_Material* pMaterial, const RHMONO_STRING* filename)
{
  int rc = -1;
  INPUTSTRINGCOERCE(_filename, filename);
  if( pMaterial && _filename)
  {
    rc = pMaterial->AddTexture(_filename, ON_Texture::emap_texture);
  }
  return rc;
}
Ejemplo n.º 20
0
RH_C_FUNCTION int ON_Material_FindBitmapTexture(const ON_Material* pConstMaterial, const RHMONO_STRING* filename)
{
  int rc = -1;
  INPUTSTRINGCOERCE(_filename, filename);
  if( pConstMaterial )
  {
    rc = pConstMaterial->FindTexture(_filename, ON_Texture::bitmap_texture);
  }
  return rc;
}
Ejemplo n.º 21
0
RH_C_FUNCTION void ON_HatchPattern_SetString(ON_HatchPattern* pHatchPattern, const RHMONO_STRING* str, bool name)
{
  if( pHatchPattern )
  {
    INPUTSTRINGCOERCE(_str, str);
    if( name )
      pHatchPattern->SetName(_str);
    else
      pHatchPattern->SetDescription(_str);
  }
}
Ejemplo n.º 22
0
RH_C_FUNCTION void ON_DimStyle_SetString(ON_DimStyle* pDimStyle, const RHMONO_STRING* str, bool prefix)
{
  if( pDimStyle )
  {
#if defined(RHINO_V5SR) || defined(OPENNURBS_BUILD)// only available in Rhino 5
    INPUTSTRINGCOERCE(_str, str);
    if( prefix )
      pDimStyle->SetPrefix(_str);
    else
      pDimStyle->SetSuffix(_str);
#else
    INPUTSTRINGCOERCE(_str, str);
    wchar_t* _hack_str = const_cast<wchar_t*>(_str); //this should have been const. It is not modified
    if( prefix )
      pDimStyle->SetPrefix(_hack_str);
    else
      pDimStyle->SetSuffix(_hack_str);
#endif
  }
}
Ejemplo n.º 23
0
RH_C_FUNCTION ON_TextLog* ON_TextLog_New2(const RHMONO_STRING* _filename)
{
  INPUTSTRINGCOERCE(filename, _filename);
  if( filename && filename[0] )
  {
    FILE* text_fp = ON::OpenFile(filename,L"w");
    if( !text_fp )
      return NULL;
    return new ON_TextLog(text_fp);
  }
  return new ON_TextLog();
}
Ejemplo n.º 24
0
RH_C_FUNCTION void ON_TextDot_GetSetText(ON_TextDot* ptr, bool set, const RHMONO_STRING* _text, CRhCmnStringHolder* pStringHolder)
{
  INPUTSTRINGCOERCE(text, _text);
  if( ptr )
  {
    if( set )
      ptr->SetTextString(text);
    else
    {
      if( pStringHolder )
        pStringHolder->Set(ptr->TextString());
    }
  }
}
Ejemplo n.º 25
0
RH_C_FUNCTION const RHMONO_STRING* ON_Object_GetUserString(const ON_Object* pObject, const RHMONO_STRING* _key)
{
  const RHMONO_STRING* rc = NULL;
  if( pObject && _key )
  {
    INPUTSTRINGCOERCE(key, _key);
    ON_wString s;
    if( pObject->GetUserString(key, s) )
    {
      theGetUserString.Set(s);
      rc = theGetUserString.Array();
    }
  }
  return rc;
}
Ejemplo n.º 26
0
RH_C_FUNCTION void ON_InstanceDefinition_SetString( ON_InstanceDefinition* pInstanceDefinition, int which, const RHMONO_STRING* _str)
{
  const int idxName = 0;
  const int idxDescription = 1;

  if( pInstanceDefinition )
  {
    INPUTSTRINGCOERCE(str, _str);
    if( idxName == which )
    {
      pInstanceDefinition->SetName(str);
    }
    else if( idxDescription == which )
    {
      pInstanceDefinition->SetDescription(str);
    }
  }
}
Ejemplo n.º 27
0
RH_C_FUNCTION bool ON_Material_AddTexture(ON_Material* pMaterial, const RHMONO_STRING* filename, int which)
{
  // const int idxBitmapTexture = 0;
  const int idxBumpTexture = 1;
  const int idxEmapTexture = 2;
  const int idxTransparencyTexture = 3;
  bool rc = false;
  if( pMaterial && filename )
  {
    ON_Texture::TYPE tex_type = ON_Texture::bitmap_texture;
    if( idxBumpTexture==which ) tex_type = ON_Texture::bump_texture;
    if( idxEmapTexture==which ) tex_type = ON_Texture::emap_texture;
    if( idxTransparencyTexture==which ) tex_type = ON_Texture::transparency_texture;
    int index = pMaterial->FindTexture(NULL, tex_type);
    if( index>=0 )
      pMaterial->DeleteTexture(NULL, tex_type);
    INPUTSTRINGCOERCE(_filename, filename);
    rc = pMaterial->AddTexture(_filename, tex_type)>=0;
  }
  return rc;
}