Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all 383 articles
Browse latest View live

Call to Microsoft PowerPoint from MDL

$
0
0

Is there a way from MDL (no native, C only) to pass a powerpoint file name to windows and display it in powerpoint?

 

Thanks in advance.

Curt


[C/C++ MDL V8i] USTN Console - Press ENTER to continue or wait for 5s.

$
0
0

Hello, I need in my MDL app to make a message 'Press ENTER to continue or wait for 5s', but I can not find a way t:

  1. catch user press
  2. detect if console is a foreground window

This is what I tried without success (code normally works in console application):

      toolSubsystem_printf("Press ENTER to continue or wait for 5s...");

      HWND console_wnd = ::GetConsoleWindow();

      boost::timer tim;
      while ( tim.elapsed() < 5.0 )
      {
        if (
          ::GetForegroundWindow() == console_wnd &&   // does not work in USTN
          ::GetAsyncKeyState(VK_RETURN) == -32767 )   // does not work in USTN
        {
          toolSubsystem_printf("\r\n");
          break;
        }

        ::Sleep(0);
      }

How can I do that?

EDIT: I have also tried getc and toolSubsystem_getStdin but also without success (throws exception due to incpompatibility of FILE pointer)...

[mdl/V8i] How to prevent a model change from the View Groups toolbar

$
0
0

Hi,

I want to prevent the user from changing model and I can't find a way to prevent the change made from the View Groups toolbar.

The other ways, such as menu, can be prevented by returning INPUT_COMMAND_REJECT from the INPUT_COMMAND_FILTER callback.

But this callback isn't done, as far as I can see, if the model is changed from the toolbar.

Does anyone know how to prevent the model change in this specific case?

Thanks
Christian

User profiles

$
0
0

I want to write a macro that covers our printing needs. Part of that macro will need to know which user configuration file is currently in use. Are there any "keyins" or other instructions that I should use to inquire the profile and return a result?

Set a global origin macro

$
0
0

I am looking to set a global origin that finds a corner of a border that is a cell and sets the bottom left hand corner to 0,0.

Error encountered MYAPP sample MDL delivered from MicoStation SDK

$
0
0

Hello,

I tried to run myapp by opening MicroSation Developer Shell,  typing cd + path ofmy app then type bmake myapp,  however, I encoutered an error which is BMAKE: Call trace. Note: MicroStation and MicroStation SDK has the same version.

Respectfully yours,

Aldrin Almia

MDL using C++code convert to .mke file etc.

$
0
0

Hello,

I got the source code below from link/forum and I want to run it. However, I don't know what are the steps in creating it into .mke file  or other files like from the delivered example of MicroStation SDK so that I can able to run it in MicroStation.

#include files

#include <mselems.h>
#include <mstypes.h>
#include <msscancrit.fdf>
#include <elementref.h>

Data Structure to Communicate between your Callback Function and the Scanner

// Structure we use to pass data to and from our callback function
typedef struct scancallback_
{
    int    nElements;

} ScanCallBackData;

Your Callback Function

// Scan callback function set by mdlScanCriteria_setElemRefCallback 
int ElementRefScanCallback (ElementRef, void *callbackArg, ScanCriteriaP)
{
    ScanCallBackData*	data	= (ScanCallBackData*)callbackArg;// We're doing nothing but count elements
    ++(data->nElements);
    return SUCCESS;
}

Scan Function

// The scanning function that does most of the work
int ScanForLinearElements (DgnModelRefP modelRef)
{
    UShort              typeMask [6];
    ScanCallBackData    data;
    data.nElements = 0;
    ScanCriteriaP	criteria = mdlScanCriteria_create ();
    mdlScanCriteria_setModel (criteria, modelRef);// Tell the scanner to call our function for each element found
    mdlScanCriteria_setReturnType (criteria, MSSCANCRIT_ITERATE_ELMREF, FALSE, TRUE);
    mdlScanCriteria_setElemRefCallback (criteria, ElementRefScanCallback, &data);// Tell the scanner we're interested only in certain types of element// See mselems.h for the TMSK0_ macros 
    memset (typeMask, 0, sizeof (typeMask));
    typeMask[0] = TMSK0_LINE | TMSK0_LINE_STRING;
    mdlScanCriteria_setElementTypeTest (criteria, typeMask, sizeof (typeMask));// Execute the scan
    mdlScanCriteria_scan (criteria, NULL, NULL, NULL);
    mdlScanCriteria_free (criteria);
    return data.nElements;
}

 

Best Regards,

Aldrin

Debug/BreakPoint MDL using C++?

$
0
0

Hello,

From the delivered MDL Project examples of MicroStation SDK using C++, can I able to debug it or put breakpoint so that I can trace the code while running the program? Please advice how, thank you.

Best Regards,

Aldrin


[V8i VB.Net]

$
0
0

Hello,

with Bentley Geospatial Administrator was created xml file with information. Based on this xml file using Visual Studio 2010 I wrote a small application(Windows Form Application), which has one form with 1 text box and 2 comboBox. But how I could add my appllication to BentleyMap?

Bentley Map V8i(SELECTseries 3) 08.11.09.107

Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel


Microsoft .NET Framework
Version 4.5.50709 RTMRel


Installed Version: Professional

Changing the Graphic Group of cell elements

$
0
0

Hi Freinds,

I am modifying the Linear elements along with Point Elements (Cell and Text). After matching with target elements by rotation and scaling the elements. It is lossing the Graphic Group and another GGroup will be assigning. So i have tried to implement by setting the GGroup by get/Set. My code  is given below:

mdlElmdscr_readToMaster(&msedSrcElmP, elmDetailsP->ulElmFilPos, elmDetailsP->dgnModelRef, FALSE, NULL); --- Reading

mdlElmdscr_getProperties  (NULL, &uintggNum, NULL, NULL, NULL, NULL, NULL, NULL, msedSrcElmP); -- GGroup

mdlElmdscr_duplicate (&msedNewElmP, msedSrcElmP);

  mdlVec_subtractPoint (&dpSubPt, &dpNewOrgPt, &dpOrgPt);
    
  mdlTMatrix_getIdentity (&tMatrixNew);
   
  mdlTMatrix_setTranslation (&tMatrixNew, &dpSubPt);

  mdlElmdscr_transform(msedNewElmP, &tMatrixNew); ---- after Transforming
    
  mdlElmdscr_rewrite (msedNewElmP, msedSrcElmP, ulCurFilPos); ---   

mdlElmdscr_setProperties  (msedNewElmP,NULL, &uintggNum, NULL, NULL, NULL, NULL, NULL, NULL); - updating the Original GGroup

  mdlElmdscr_rewrite (msedNewElmP, msedNewElmP, ulCurFilPos); - rewriting

Please suggest me to resolve this issue.

Thanks,

Sreekanta.M

MDL Code Inquiry

$
0
0

Hello

Can someone explain the code inside the red box below? 

                                                              

Code above was from sir Yongan's example HelloWord. I tried to run the app but I don't know if it scans or what linear element it scan. Maybe if it possible like MVBA we can add message box what Linear element it scans for debugging purposes.

Best Regards,

Aldrin                                                                                

Problem While Creating Flood Area

$
0
0

Hi Guys,

Please find the attached Image.

Fig1 : Red Element is the Flood Element Created using the Macro, Flood Element Z Coordinates remaining same for all the vertices as shown in the image(Rotate View).

How can i Assign the Elements Z Coordinates to the Flood Element ?

Requirement : Creating Sharing Edge.

mdlElement_setSymbology

$
0
0

Hello,

I encountered error when I entered bmake -a in MicroStation Dev Shell. See image below.

Using line of code below.

The ouput I want to do is to change the color of line and line string elements.

Best Regards,

Aldrin

[v8i SS2 MDL] Getting level ID of a Cell

$
0
0
Hi,
I am getting a nested Cell's level ID using the code below. 
But this code fails because there is Smart Solid header which does not contain any level ID in the element information below.
So, it returns default level ID but this is wrong.
I don't want to test all element types and I think there must be a better way to find a nested Cell's level ID.
// Get level of a cell
void akElmdscr_getLevel
(
MSElementDescr **edP,
ULong *levelid
)
{
*levelid = 0;

#if defined (MSVERSION) && (MSVERSION >= 0x8b0)
/*status = */mdlModify_elementDescr2(edP,ACTIVEMODEL,MODIFY_REQUEST_NOHEADERS, naElmfunc_getLevel,levelid,0);
#else
/*status = */mdlModify_elementDescr(edP,ACTIVEMODEL,MODIFY_REQUEST_NOHEADERS, naElmfunc_getLevel,levelid,0);
#endif
}


/* Element function to get level of first element after the header */
int naElmfunc_getLevel
(
MSElementUnion *elP, /* <=> element to be modified */
UInt32 *level, /* => user parameter ( level of elmdscr ) */
DgnModelRefP fileNum, /* => file # for current elem */
MSElementDescr *elmDscrP, /* => element descr for elem */
MSElementDescr **newDscrPP /* <= if replacing entire descr */
)
{
if( mdlElement_getType(elP) != CELL_HEADER_ELM )
{
/* Get level of the element */
mdlElement_getProperties (level, NULL, NULL, NULL, NULL, NULL, NULL, NULL, elP);
return (MODIFY_STATUS_ABORT); /* Level got, abort process */
}
return (MODIFY_STATUS_NOCHANGE);
}

Regards,
Ahmet Sedat ALIS

Standard Documentation of MDL API

$
0
0

Hello,

May I know where I can find Standard Documentation of MDL API? I'm learning MDL and without studying C, C++ and documents of MDL, it's impossible for me to learn. Thank you. ^_^

Best Regards,

Aldrin


[v8i SS2 MDL] mdlImage_renderViewToRGB() renders different from Luxology screen

$
0
0

Hi,

On Luxology render screen, I see render result and then saving it using mdlImage_renderViewToRGB() to save the rendered image. But rendered image is darker then Luxology screen. I also tried mdlImage_saveViewToRGB() which gives the same result. When I tried mdlImage_saveView() it always returns MDLERR_CANNOTOPENFILE even file path is true and directory exist.

How can I set both results the same?

Luxology screen rendered image;


Image saved by mdlImage_renderViewToRGB() function;

Luxology screen view;

Regards,

Ahmet Sedat ALIS

AEC Technology

[v8i SS2 MDL] Saving Luxology rendered image

$
0
0

Hi,

How can I save Luxology rendered image to file in MDL? I want to save latest image or viewed image rendered from Luxology image cache.

Regards,

Ahmet Sedat ALIS

AEC Technology

[V8i MDL] Select Series 3 MS_DWGSAVEAPPLICATIONDATA=1 (or ON) not working

$
0
0

I store critical data as type 66 level 20 application data. I have a Bentley assigned signature. This works for ALL versions of MicroStation. I have included the V8 code. This does not work in an AutoCAD DWG file with any version of V8 from 2004 thru SS3. I set MS_DWGSAVEAPPLICATIONDATA=ON or MS_DWGSAVEAPPLICATIONDATA=1 but the application data is just not there. Please remember, this is a DWG question. This code works in DGN files and has for several years. Thank you for any help. I have customers that will drop Civil-3D and AutoCAD for design and use Splash if we can resolve this one issue. Also, the Startup record does not work in a DWG file. (P.S. I do not get any of my error dialogs.)

This code is pretty much straight out of the MDL examples of CIRCUIT AND APPLCELEM

/*----------------------------------------------------------------------+
|                                                                                                |
|       V E R S I O N    8    M I C R O S T A T I O N               |
|                                                                                                |
|       HANDLE SAVING/RECALLING THE SPLASH CLIPBOARD                    |
|                                                                                                |
+----------------------------------------------------------------------*/
#if SPLASH_VERSION8 == 1
/*----------------------------------------------------------------------+
|                                                                                                |
|   The following routines store and recall application data            |
|                                                                                                |
+----------------------------------------------------------------------*/
/*----------------------------------------------------------------------+
|                                                                                               |
| name          splash_createApplicationHeader - create application     |
|                       header common to all application elements       |
|                                                                                               |
| author        BSI                                    9/91                        |
| author        Norman E. Smith                        6/02           |
|                                                                                               |
+----------------------------------------------------------------------*/
Private void    splash_createApplicationHeader
(
MSElement       *elP,               /* <=> element to set up header info */
int             fileFormatDataSize, /*  => size (in bytes) of application data */
int             signature           /*  => assigned signature value */
)
    {
    /* ------------------------------------------------------------------
       Set up the required portions of the header :
       Set type to the MicroStation application element.
       Set level to the assigned level.
       Set elementSize to size of our element in words.
       ------------------------------------------------------------------ */
    memset (elP, 0, sizeof (MSElement));
     
    elP->ehdr.type        = MICROSTATION_ELM;
    elP->ehdr.level       = MSAPPINFO_LEVEL;
    elP->ehdr.elementSize = (offsetof (ApplicationElm, appData) +
                            fileFormatDataSize + 1)/2;

    /* ------------------------------------------------------------------
       We set the offset to attributes in the element header.
       In this case we have no attribute data on the
       element, so it is the same as the element size.
       ------------------------------------------------------------------ */
    elP->ehdr.attrOffset  = elP->ehdr.elementSize;
     
    /* the rest of the header information is already correctly set to zero */

    /* ------------------------------------------------------------------
       Set the signature word in the element. We need to swap the signature
       word because the scanner operates on the first 20 words of the
       element. When the scanner returns this to us, it will be correctly
       aligned and swapped.
       ------------------------------------------------------------------ */
    elP->applicationElm.signatureWord = LNK_USERATTR_SIGNATURE;
    SWAP_BYTE (&elP->applicationElm.signatureWord);
    }

/*----------------------------------------------------------------------+
|                                                                                               |
| name          splash_deleteAllApplicationElements     |
|               Deletes all splash application elements in file         |
| author        Norman E. Smith                        6/02            |
|                                                                                                |
+----------------------------------------------------------------------*/
Public void      splash_deleteAllApplicationElements
(
int          signature      /* => our assigned signature */
)
    {
    int         status, scanSize;
    short       signatureTest;
    Scanlist    scanList;
    ULong       filePos,elementFilePos;
    ULong       scanBuf[MIN_ELEMDATA_SCANBUF_SIZE];
    ScanBuffer  *sbP = NULL;

    /* zero everything we won't need */
    memset (scanBuf, 0, sizeof (scanBuf));
 
    /* initialize the scanList */
    mdlScan_initScanlist (&scanList);
    mdlScan_noRangeCheck (&scanList);
 
    scanList.scantype     = ELEMTYPE | LEVELS | ONEELEM | BOTH;
    scanList.typmask[4]   = TMSK4_MICROSTATION_ELM; /* scan for type 66 only */
    scanList.levmask[1]   = ELMBITMSK (MSAPPINFO_LEVEL);  /* scan for level 20 only */
    scanList.extendedType = FILEPOS;
 
    /* use mdlScan_initialize, mdlScan_file to find element */
    mdlScan_initialize (ACTIVEMODEL, &scanList);
    do
        {
        status = mdlScan_file (scanBuf, &scanSize,
                                sizeof (scanBuf), &filePos);
        if (scanSize > 0 )
            {
            elementFilePos = scanBuf[0];
            sbP = (ScanBuffer *) &scanBuf[0];
 
            /*-----------------------------------------------------------
            Check signature word
            -----------------------------------------------------------*/
            signatureTest = sbP->elm.applicationElm.signatureWord;
            SWAP_BYTE (&signatureTest);
            if (signatureTest == signature)
                {
                if ( mdlElement_undoableDelete(NULL,elementFilePos,FALSE) != SUCCESS )
                    {
                    /* Splash cannot delete application data from design file */
                    mdlDialog_openMessageBox(DIALOGID_MsgBoxOK,
                                             TXT_MESSAGE_SPLASH_33,
                                             MSGBOX_ICON_INFORMATION);
                    SplashSysExit();
                    }
 
                }
            }
        } while (scanSize && (status == BUFF_FULL));
    }
 
/*----------------------------------------------------------------------+
|                                                                                                |
| name          splash_retrieveApplicationData - get application data   |
|                       from design file                                             |
|                                                                                                |
| author        BSI                                     9/91                        |
| author        Norman E. Smith                         6/02           |
|                                                                                                |
+----------------------------------------------------------------------*/
Private int     splash_retrieveApplicationData
(
ApplicationData *appDataP,          /* <= pointer to data for storage */
ULong           ddbId,
int             record
)
    {
    int         status, scanSize;
    short       signature;
    ULong       filePos, scanBuf[MIN_ELEMDATA_SCANBUF_SIZE];
    Scanlist    scanList;
    ScanBuffer  *sbP = NULL;
 
    /* zero everything we won't need */
    memset (scanBuf, 0, sizeof (scanBuf));
 
    /* initialize the scanList */
    mdlScan_initScanlist (&scanList);
    mdlScan_noRangeCheck (&scanList);
 
    scanList.scantype   = ELEMTYPE | LEVELS | ONEELEM | BOTH;
    scanList.typmask[4] = TMSK4_MICROSTATION_ELM;       /* scan for type 66 only */
    scanList.levmask[1] = ELMBITMSK (MSAPPINFO_LEVEL);  /* scan for level 20 only */
 
    /* use mdlScan_initialize, mdlScan_file to find element */
    mdlScan_initialize (ACTIVEMODEL, &scanList);
 
    do
        {
        status = mdlScan_file (scanBuf, &scanSize, sizeof (scanBuf), &filePos);
 
        if (scanSize)
            {
            sbP = (ScanBuffer *) &scanBuf[0];
 
            /*-----------------------------------------------------------
            Check signature word
            -----------------------------------------------------------*/
            signature = sbP->elm.applicationElm.signatureWord;
            SWAP_BYTE (&signature);
            if (signature == LNK_USERATTR_SIGNATURE)
                {
                /* Convert the rest of the element to internal format. */
                mdlCnv_bufferFromFileFormat (NULL, NULL,
                                    (byte *) appDataP, NULL,
                                    (byte *) sbP->elm.applicationElm.appData, ddbId, NULL);
                if ( appDataP->recordNumber == record ) return SUCCESS;
                }
            }
 
        } while (scanSize && (status == BUFF_FULL));
 
    return ERROR;
    }
 
/*----------------------------------------------------------------------+
|                                                                                                |
| name          splash_storeApplicationData - store application data    |
|                       in file                                                                |
|               Caller must set record number                          |
|                                                                                                 |
|                                                                                                 |
| author        BSI                                     9/91                         |
| author        Norman E. Smith                         6/02            |
|                                                                                                 |
+----------------------------------------------------------------------*/
Private int     splash_storeApplicationData
(
ApplicationData *appDataP,  /* => Data to be converted and saved. */
ULong           ddbId       /* => RscId for data conv. rules. */
)
    {
    int         fileFormatDataSize;
    ULong       filePos = 0L;
 
    /* Compute size of application data to set elementSize */
    if (SUCCESS == mdlCnv_calcFileSizeFromDataDef (&fileFormatDataSize, NULL,
                                                   (byte *) appDataP, ddbId, NULL))
        {
        MSElement   el;
 
        splash_createApplicationHeader (&el, fileFormatDataSize, LNK_USERATTR_SIGNATURE);
 
        /* Copy and convert the data portion of the element */
        if (SUCCESS == mdlCnv_bufferToFileFormat (NULL, (byte *) el.applicationElm.appData,
                                                  NULL, (byte *) appDataP, ddbId, NULL))
            {
            /* store the element at the end of file */
            filePos = mdlElement_add (&el);
            }
        }
         
    /* check return from mdlElement_add. If file position is 0, a */
    /* problem occured with the write, and mdlErrno has the error */
    /* number in it. Otherwise return SUCCESS.                    */
    return (filePos == 0L ? mdlErrno : SUCCESS);
    }
 
/*----------------------------------------------------------------------+
|                                                                                                |
|               Store Master (Clipboard) in Design file           |
| author        Norman E. Smith                                            |
|                                                                                                |
+----------------------------------------------------------------------*/
Public void storeMaster
(
)
    {
    ApplicationData appData;
    int             nrec;
 
    /* Delete all Splash application elements */
    splash_deleteAllApplicationElements (LNK_USERATTR_SIGNATURE);
 
    for (nrec=0; nrec<LOOPS_TO_STORE_CB; nrec++ )
       {
       appData.recordNumber = SPLASHCB_VERSION*100+nrec;
       memcpy(appData.master,&mapP->clipbd[nrec*SPLASH_APPDATA_SIZE],
                             SPLASH_APPDATA_SIZE*sizeof(long int));
       if ( splash_storeApplicationData (&appData,
                        RSCID_AppData_DataDefBlock) )
          {
           /* Splash cannot store application data in design file */
           mdlDialog_openMessageBox(DIALOGID_MsgBoxOK,
                                    TXT_MESSAGE_SPLASH_31,
                                    MSGBOX_ICON_INFORMATION);
          SplashSysExit();
          }
       }
    }    
 
/*----------------------------------------------------------------------+
|                                                                                                |
|               Recall Master (Clipboard) from Design file    |
| author        Norman E. Smith                                            |
|                                                                                                |
+----------------------------------------------------------------------*/
Public void recallMaster
(
)
    {
    ApplicationData appData;
    int             nrec;
 
    for (nrec=0; nrec<LOOPS_TO_STORE_CB; nrec++ )
       {
       if ( splash_retrieveApplicationData (&appData,
                           RSCID_AppData_DataDefBlock,SPLASHCB_VERSION*100+nrec))
          {
           /* Splash cannot recall application data from design file */
           /*
           mdlDialog_openMessageBox(DIALOGID_MsgBoxOK,
                                    TXT_MESSAGE_SPLASH_32,
                                    MSGBOX_ICON_INFORMATION);
           */
           return;
          }
       memcpy(&mapP->clipbd[nrec*SPLASH_APPDATA_SIZE],appData.master,
                                    SPLASH_APPDATA_SIZE*sizeof(long int));
       }
    /* Put expanded SPLASH_HOME directory name in clipboard */
    mdlSystem_getCfgVar (cfgVarValue, "SPLASH_HOME", sizeof(cfgVarValue));
    cfgVarExpansion = mdlSystem_expandCfgVar (cfgVarValue);
    if ( cfgVarExpansion == NULL )
       {
       /* SPLASH_HOME configuration variable not set  */
        mdlDialog_openMessageBox(DIALOGID_MsgBoxOK,
                                 TXT_MESSAGE_SPLASH_101,
                                 MSGBOX_ICON_INFORMATION);
        exit (1);
       }
    strcpy(splashP->homeDir,cfgVarExpansion);
    free (cfgVarExpansion);
 
    /* Put expanded DIM2_PATH directory name in clipboard */
    mdlSystem_getCfgVar (cfgVarValue, "DIM2_PATH", sizeof(cfgVarValue));
    cfgVarExpansion = mdlSystem_expandCfgVar (cfgVarValue);
    if ( cfgVarExpansion != NULL )
       {
        strcpy(splashP->dim2Dir,cfgVarExpansion);
        free (cfgVarExpansion);
       }
    else
       {
        splashP->dim2Dir[0] = NULL;
       }
       
    strcpy(splashP->SitTabKode,"    ");
    strcpy(splashP->SitTabIdesc,"                    ");
    splashP->HorAttNysnak = 0; /* Turn off display of Plan Panel Snake */
    }
#endif
/*----------------------------------------------------------------------+
|                                                                                                |
|       E N D    O F    V E R S I O N    8    M I C R O S T A T I O N   |
|                                                                       |
|       HANDLE SAVING/RECALLING THE SPLASH CLIPBOARD                    |
|                                                                                                |
+----------------------------------------------------------------------*/

Call VB Program from MicroStation

$
0
0

Hello,

Is it possible to call a VB 6 program using MicroStation?

Best Regards,

Aldrin

.NET Platform applicable to create MDL commands

$
0
0

Hello,

What are the applicable .NET Platforms used  to create MDL commands?

Best Regards,

Aldrin

Viewing all 383 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>