Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computer Aided Design - CAD > Programming with Microstation > Re: Linkage att...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 434 of 473
Post > Topic >>

Re: Linkage attributes

by Krzysiek <krzysztofstolarski@[EMAIL PROTECTED] > Apr 26, 2007 at 01:39 PM

Krzysiek pisze:
> Hello
> 
> I have a problem. I'm trying to add attribute to element but I haven't 
> still done it. So I decided to write a program to testing but it doesn't

> work too. What I do wrong ? Why function mdlLinkage_appendToElement 
> cannot add attribute to element ?
> 
> test.mc:
> 
> #include <mdl.h>
> #include <mselems.h>
> #include <stdio.h>
> #include <string.h>
> 
> #include "test.h"
> 
> #include <mselemen.fdf>
> #include <mscurrtr.fdf>
> #include <mssystem.fdf>
> #include <mslinkge.fdf>
> #include <msdialog.fdf>
> 
> #define TESTID             999
> 
> #define ID_GRAF            1
> 
> int main(int argc, char *argv[])
> {
>     DPoint3d p[2] = {{0.0,0.0,0.0},
>                      {50.0,50.0,0.0}};
>     MSElement el;
>     LinkageHeader header;
>     Attr att;
>     AttrRecv copy;
>     UInt fPos;
>     char napis[200];
>     
> 
>     memset(&header, 0, sizeof(LinkageHeader));
>     header.info    =0;
>     header.remote    =0;
>     header.modified    =0;
>     header.user = 1;
>     header.primaryID = TESTID;
>     att.id = 500;
>     
>     mdlCurrTrans_begin ();
>     mdlCurrTrans_masterUnitsIdentity(TRUE);
> 
>     if (mdlLine_create(&el, NULL, p) != SUCCESS)
>     {
>         printf("nie udało się utworzyć elementu!\n");
>         return 1;
>     }
>     mdlCurrTrans_end ();
> 
>     mdlElement_display(&el, NORMALDRAW);
>     
> 
>     if(mdlLinkage_appendToElement(&el, &header, &att, ID_GRAF, NULL) != 
> SUCCESS)
>     {
>         mdlDialog_openInfoBox("Nie podpięto atrubutu");
>         mdlSystem_unloadMdlProgram("userlink");
>         return  1;
>     }
>     else
>         mdlDialog_openInfoBox("Podpieto atrybut");
>     
>     //mdlElement_rewrite(&el, NULL, fPos);
>     fPos = mdlElement_add(&el);
>     if (fPos<= 0L)
>     {
>         printf("nie udało się dodać elementu do pliku!\n");
>         mdlSystem_unloadMdlProgram("userlink");
>         return 1;
>     }
>     
>     if (mdlLinkage_extractFromElement( &copy, &el, TESTID, ID_GRAF,NULL,

> NULL, NULL) != SUCCESS)
>     {
>         mdlDialog_openInfoBox("Nie zczytano atrybutu");
>         mdlSystem_unloadMdlProgram("userlink");
>         return  1;
>     }
>     else
>     {   
>         sprintf(napis, "Atrybut ma wartość = %d", copy.id);
>         mdlDialog_openInfoBox(napis);
>     }
>     mdlSystem_unloadMdlProgram("userlink");
>     return  0;    /*meaningless int value returned by main */
> }
> 
> 
> test.h:
> 
> #include <mselems.h>
> 
> typedef struct attr {
>     int id;
> } Attr;
> 
> typedef struct attr_Recv {
>     LinkageHeader header;
>     int id;
> } AttrRecv;
> 
> test.mt
> 
> #include "test.h"
> 
> createDataDef (attr, TEST);
> 
> 
> 
> I hope you can help me.
> Thanks
> Krzysztof

When I got on top lines:

RscFileHandle   rscFH;

mdlResource_openFile (&rscFH, NULL, 0);

I can append attribute but I still can't extract attribute from element. 
I get info that the stored value is equal 0.

What could by wrong ?

Krzysztof
 




 2 Posts in Topic:
Linkage attributes
Krzysiek <krzysztofsto  2007-04-26 10:44:12 
Re: Linkage attributes
Krzysiek <krzysztofsto  2007-04-26 13:39:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 14:13:41 CST 2008.