[v8i SS2 MDL] Opening material table

Hi,

In MicroStation v8i SS2, when you copy a DGN file and its related MAT file with the same name, MAT reference may still show previous copied file. When I apply Material Editor > Table > Open command and select new MAT file it fixes the problem. It works fine in MicroStation v8i SS3.

How can I open a material table in MDL as described?

I found some mdlMaterial_xxx functions but they are used dynamically open table and free them when done.

"material activate" key-in seems to be used for this purpose but it is not accepting filename parameter.

Regards,

Ahmet Sedat ALIS

AEC Technology

Parents
  • > mdlMaterial_xxx functions but they are used dynamically open table and free them when done.

    mdlMaterial_loadTable seems to take the material file name as the last argument.

    Unsure what do you mean needs to be freed afterwards here... but I guess save settings might be required.

    Cheers,

    /Chris Z.

  • Unknown said:

    mdlMaterial_loadTable seems to take the material file name as the last argument.

    Unsure what do you mean needs to be freed afterwards here... but I guess save settings might be required.

    Hi Chris

    Thank you.

    Something like this will read material table but it will free it from memory later. I think it is a memory operation.

    Can we load more than one material table?

    mdlMaterial_initialize()
    mdlMaterial_loadTable(NULL, NULL, NULL, NULL, NULL, ..., filename)
    mdlMaterial_freeTable(..)
    mdlMaterial_cleanup()

    Regards,

    Ahmet Sedat ALIS
    AEC Technology 

    Kind regards,

    Sedat Alis
    AEC Technology Inc.

  • Unknown said:
    Something like this will read material table but it will free it from memory later. I think it is a memory operatio

    The entire materials API relies on dynamic data structures.  Unfortunately, since this is a C API, it's up to the programmer to manage memory allocation and deallocation, and there's a lot of that going on.

    If you are writing in C++, take the time to write some classes that wrap memory management.  That is, use the Resource Acquisition is Initialisation idiom to create and destroy memory …

     class MaterialWrapper 
    {
    private:
       MaterialType* data_;
    public:
       MaterialWrapper () { /* allocate material to data_ */ }
       ~MaterialWrapper () { /* destroy data_ */ }
    };

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:

    Something like this will read material table but it will free it from memory later. I think it is a memory operatio

    The entire materials API relies on dynamic data structures.  Unfortunately, since this is a C API, it's up to the programmer to manage memory allocation and deallocation, and there's a lot of that going on.

    If you are writing in C++, take the time to write some classes that wrap memory management.  That is, use the Resource Acquisition is Initialisation idiom to create and destroy memory …

     class MaterialWrapper 
    {
    private:
       MaterialType* data_;
    public:
       MaterialWrapper () { /* allocate material to data_ */ }
       ~MaterialWrapper () { /* destroy data_ */ }
    };

    [/quote]

    Hi Jon,

    Thank you.

    Regards,

    Ahmet Sedat ALIS
    AEC Technology 

    Kind regards,

    Sedat Alis
    AEC Technology Inc.

Reply
  • Unknown said:

    Something like this will read material table but it will free it from memory later. I think it is a memory operatio

    The entire materials API relies on dynamic data structures.  Unfortunately, since this is a C API, it's up to the programmer to manage memory allocation and deallocation, and there's a lot of that going on.

    If you are writing in C++, take the time to write some classes that wrap memory management.  That is, use the Resource Acquisition is Initialisation idiom to create and destroy memory …

     class MaterialWrapper 
    {
    private:
       MaterialType* data_;
    public:
       MaterialWrapper () { /* allocate material to data_ */ }
       ~MaterialWrapper () { /* destroy data_ */ }
    };

    [/quote]

    Hi Jon,

    Thank you.

    Regards,

    Ahmet Sedat ALIS
    AEC Technology 

    Kind regards,

    Sedat Alis
    AEC Technology Inc.

Children
No Data