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

Ribbon Sync event triggered by MDL LOAD key-in?

$
0
0

Hi,

is there any sync event (similar to SYNCITEM_SystemEvent_ActiveModelChanged etc.) that is broadcasted when an application is (un)loaded?

An idea behind this question is to have Visibility condition defined for the whole workflow and to evaluate this condition automatically when an application is loaded / unloaded. If the condition will be IsMdlLoaded expression, I assume the workflow should be displayed and hidden autmoatically accordingly to the application load and unload.

Or the recommended practice is to defined own SyncGroup, so every application should throw own specific sync event?

With regards,

  Jan


Ribbon search behaves weird for custom tools?

$
0
0

Hi,

based on this discussion how ribbon search tool works with custom ribbon item or whether it's bug.

Scenario / conditions:

  • There is workflow with visibility condition defined, e.g. to evaluate whether MDL application is loaded, a design file is dnglib etc.
  • There are buttons in the ribbon with own visiblity conditions like a selection set is active etc.

I have had not enough time for detail and extensive testing, but so far I experienced 3 different scanarios:

  • Delivered Admin workflow: Displayed when dgnlib file is opened. Tools from this workflow are displayed in search results only when the workflow can be selected. When normal design file is opened, the tools are not included in the search. This is how I expect MicroStation should work.
  • Custom workflow in dgnlib: Buttons are not included in the search, even when the workflow is displayed. In some situations it seems only buttons with conditions are not included and others not.
  • Custom workflow in XML: Opposite behaviour, the tools are always included in the search results, even when the workflow is not available.
  • Custom workflow compiled to rsc file: Not tested.

Maybe I am doing something wrong, but the behaviour seems to be not consistent.

With regards,

  Jan

[CONNECT C++] ReadAndLoadDgnAttachments() takes much time if reference file cannot be found

$
0
0

Hi,

I have a model which references to many other files, but these files are all missing. (see the picture below)

 

It surpreised me that ReadAndLoadDgnAttachments() takes almost 15 seconds.

bool loadCaches=true;
bool loadUndisplayed=true;
bool loadRasterRefs=true;

DgnAttachmentLoadOptions refLoadOption (loadCaches, loadUndisplayed, loadRasterRefs);
model.ReadAndLoadDgnAttachments (refLoadOption);

I also tried to create a model which referenced to many unfound files, but the performance issue for the ReadAndLoadDgnAttachments() cannot be reproduced.

So my question is

(1) Which factors will affect the performance of ReadAndLoadDgnAttachments()?

(2) Is there any methods to judge the referenced file is missing or not before calling ReadAndLoadDgnAttachments()?

Thanks,

Richard

[V8i C++] Checking For Levels of Cell Elements

$
0
0

I want to iterate a cell element and return TRUE if a cell contains a certain level. Once I start iterating the cell and find a "hit" for the level, there is no reason to continue and iterate the remainder of the cell's children. My question is how to break/continue the iteration so I don't corrupt memory, or leave don't release memory that should be released. Not really sure IF this is even a possible issue...

bool			hasDesiredLevel = false;
ProcessCellForLevel(&hasDesiredLevel, eh, inModel, 22009);


void	ProcessCellForLevel(bool *pHasLevel, ElemHandleR  eh, DgnModelRefP inModel, LevelCode searchLevelCode)
{
	// do something
	if (elementRef_isComplexHeader(eh.GetElemRef()) )
	{ // nothing to do...
	}
	else
	{
		// query element level
		if (levelCode == searchLevelCode)
		{
			*pHasLevel = true;
			// How to Break/Continue here ???
			return; // just return????
		}
	}

	for (ChildElemIter child (eh); child.IsValid(); child=child.ToNext())
	{
		ProcessCellForLevel(child, inModel, searchLevelCode);
	}
}

Bruce

[MVBA] Using Key Ins with OpenDesignFileForProgram

$
0
0

I need to process a dgn file using OpenDesignFileForProgram and need to use SendCommand or SendKeyIn to the file. (I am forced to use keyins as there is no VBA equivalent for keyin: ITEM DUMP)  

Is this possible? 

Attaching Database OLEDB in MDL-Code

$
0
0

Hi Everyone,

I am trying to write an MDL that creates and attaches certain Attributes to new created graphic Elements into an Access MDB-Database. Therefore I want to make sure, before the creation of new Elements starts, that the correct Database is attached. To have an overview, that the correct MDB is attached to the DGN-file there are the following 3 files with same Name created, before the MDL starts:

- <filename>.dgn  (DGN-file)

- <filename>.mdb  (Access MDB-Database)

- <filename>.udl  (Universal-Data-Link-file)

Here is a part of the Code, that should do this:

int attachDatabaseUDL
(
void
)
  {
	char dgnDevice[MAXFILENAMELENGTH]="\0";	// DGN-Device
	char dgnPath[MAXFILENAMELENGTH]="\0";	// DGN-Path
	char dgnName[MAXFILENAMELENGTH]="\0";	// DGN-Name (WITHOUT Suffix!)
	char udl_file[MAXFILENAMELENGTH]="\0";	// UDL-Filename
	int ret=0;								// Return-Value

	// Reading Name-parts of actual Design-File
	mdlFile_parseName (tcb->dgnfilenm, dgnDevice, dgnPath, dgnName, NULL);

    // Creation of UDL-Name
    strcpy (udl_file, dgnDevice);
	strcat (udl_file, ":");
	strcat (udl_file, dgnPath);
    strcat (udl_file, dgnName);
    strcat (udl_file, ".udl\0");

    // Attaching Database by use of UDLl-file
	ret=mdlDB_activeDatabase(udl_file);

    // Information about Success
    if (ret==SUCCESS) mdlOutput_status ("DB attached");
	else mdlOutput_status ("ERROR! DB NOT attached!");

	return ret;

  }

When I call this function the first time I opened the DGN-file I get an error-message

"Datenbank-Server nicht aktiv" (= Database-Server is not active)

The same happens if I key-in "DB=<full Path>\<filename>.udl" the first time. If I choose via menu "Create Database-Connection" another udl-file, detach the database afterwards and call this function again (or repeat the mentioned key-in), than it works.

So my question is, with which function can make the database-server active, so that the function works, or is there any other reason for this behaviour?

Many thanks for your help,

Ines Wieland

[CONNECT C++] How get level "Turn off" status?

$
0
0

Dear experts,

I want to know how to get the level "Turn off" status by C++ API(non-MDL prefix API).

LevelHandle::GetDisplay() seems not for this status.

GPArray::add() returns ERROR when reading a complex chain

$
0
0

Hi

I have a model with a complex chain. And it will go into following code when reading the model.

case ICurvePrimitive::CURVE_PRIMITIVE_TYPE_InterpolationCurve:
case ICurvePrimitive::CURVE_PRIMITIVE_TYPE_AkimaCurve:
default:
{
    bIsGPArray = true;

    if (SUCCESS != gpa->Add(*curveVector.get()))
        break;
    ....
}

But the return value of "gpa->Add(*curveVector.get()" is ERROR, can I regard the toolkit could not add such type of curve into GP array?

The complex chain is like:

Thanks,

Richard


[CONNECT C++] ChildElemIter not working on ElementDescriptor from ScanCriteria

$
0
0

I am porting my old v8i code to Connect and suddenly the code below is not working anymore. The code below will scan a certain level for element descriptors and I check if the type is a complex shape. If so, I will iterate through the children of the complex shape. I see the element descriptor and that it has # components, but it never jumps into the for loop.

Does anyone know why the ChildElemIter is not working?

// Setup scan
scP = mdlScanCriteria_create();
if(!scP) return ERROR;
mdlScanCriteria_setModel (scP, MASTERFILE);

mdlScanCriteria_addSingleLevelTest(scP , id);
mdlScanCriteria_setDrawnElements(scP);
mdlScanCriteria_setReturnType (scP, MSSCANCRIT_ITERATE_ELMDSCR, FALSE, FALSE);
mdlScanCriteria_setElmDscrCallback (scP, MyCallback, MASTERFILE);
mdlScanCriteria_scan (scP, 0, 0, 0);
mdlScanCriteria_free(scP);

// Callback function
void MyCallback(MSElementDescr *ElDscr, void *modelRef)
{
  if(mdlElement_getType(&ElDscr->el) == CMPLX_SHAPE_ELM)
  {
    ElementHandle eh (ElDscr, false, true);
    for (ChildElemIter child (eh); child.IsValid(); child = child.ToNext()) // Never jumps into this loop
    {
      // Do something with each line in the complex shape.
    }
  }
}

[MVBA SS3] .Range get 10 times of coordinates value

$
0
0

I'm going to zoom to selected element, I used the codes below:

Sub ZoomTo(MyElement As Element)
    Dim MyView As View
    Dim TempPnt As Point3d
    Dim TempDistance As Double
    Set MyView = CommandState.LastView
    TempDistance = Point3dDistance(MyElement.Range.Low, MyElement.Range.High)
    TempPnt = Point3dFromXYZ(5 * TempDistance, 5 * TempDistance, 0)
    MyView.SetArea Point3dSubtract(MyElement.Range.Low, TempPnt), Point3dSubtract(Point3dAdd(MyElement.Range.High, TempPnt), Point3dSubtract(MyElement.Range.Low, TempPnt)), Matrix3dIdentity(), 0
    MyView.Redraw
End Sub

It was OK before. The selected element will show in the center of the view. But yesterday it didn't work... After checked, I found the coordinates get from .range are 10 times of the actual value, and it is same dgn file, same unit. Does anyone know what's wrong? For example, .range.low get -44721.72,65617.66, but it is -4472,6561. Thanks a lot.

Note, it is a cell element in ref file. the code works for a new element in active model. But it is wired that it used to work fine for ref file also.

[CONNECT C++] Is Element a Solid?

$
0
0

I'm writing a tool that wants to check whether an element is a solid of some kind.

I think that I can do this for a primitive solid (slab, cone, extrusion etc)...

const bool DontSimplify { false };
ISolidPrimitivePtr solid = ISolidPrimitiveQuery::ElementToSolidPrimitive (eh_, DontSimplify);
bool valid = solid.IsValid ();

Or this for a SmartSolid...

ISolidKernelEntityPtr smartSolid;
bool valid = (SUCCESS == SolidUtil::Convert::ElementToBody (smartSolid, eh_)&&
             smartSolid.IsValid ());

Are those good ways to detect a solid?  How can I combine them to figure out if an element is something that has a volume that I can subsequently measure?

[CONNECT C++] How to read EC units

$
0
0

Hi Experts,

I am using DgnElementECInstance::GetValueAsString() API to read Engineer Content and in most case it can give me user friendly values like below:

However for some EC properties, this api just return value without any unit information. do you know how can I query out these corresponding units for these value?

[CONNECT C++] refFile->file_id.referenceNum equivalent

$
0
0

Hi,

I'm trying to get the equivalent of refFile->file_id.referenceNum in CONNECT, but I can't seem to find any similar methods or variables for this.

In v8i we have:

ReferenceFile *refFile=mdlRefFile_getInfo(MASTERFILE);
printf("%d\n", refFile->file_id.referenceNum)

In CONNECT we have:

DgnAttachmentP refFile=mdlRefFile_getInfo(modelRef);

refFile->????

Anyone have any suggestions on how to get the referencNum in CONNECT?

Regards,

Bjørn

[MVBA SS3] Level Override Linestyle scale?

$
0
0

I started psuedo-coding a macro to do some level override setup for putting sheets together.
One of the things I'd like to do is to set the level override linestyle scale.

Can I get to that with MVBA? As i read through the Level Properties, I don't see anything that sounds like it. I see OverrideLineStyle but not OverrideLineStyleScale.
Is this another setting that I could only get to through some kind of MDL wrapper?

Is there any documentation on "MDL wrappers"? Where would I find the documentation on MDL (in case I decide to try learning that)?
Thank you.

ECSchema Editor for V8

$
0
0

Hi,

Is there anywhere available on the Bentley where I can obtain the V8 ECSchema Editor? I'm looking to be able to view the EC Schema for a particular DGN file if possible.


[Connect C#] How do I make an Annotation Cell?

$
0
0

When plotting a cell through the Bentley Cell window,  If the cell that has annotation,  I can plot that cell by unchecking "Place as Shared Cell" and a "Annotation Cell" element is created.

If I plot the same cell with the "Place as Shared Cell" option enabled, a "Shared Cell Element" is created.

If I plot a cell that does not have any annotation and have "Place as Shared Cell" unchecked, a "Cell" element is created.

For a SharedCellElement, I can call the "AddAnnotationScale" method and it will scale to the design file drawing scale properly.

CellHeaderElement does not have this method, the only thing I could do is scale the CellHeaderElement by the annotation scale, but this would not react to changes in the design file drawing scale.

When Bentley creates an "Annotation Cell" it reacts properly to the drawing scale, but I do not know how to create this element type.

CellHeaderElement has a getter for "IsAnnotation" property, but no setter.

How does one make an "Annotation Cell" using the DgnPlatformNet API?

Thanks,

Maury

How to move the mouse pointer to a particular x,y coordinates using VBA

$
0
0

Looking for a piece of VBA code to move the mouse cursor to xy drawing coordinate (say 100,100) within Micro station. 

Microstation version: Power inroads V8i SS4

many thanks,

Vinoth Joseph

[MVBA SS3] How to get projected distance of two points about view Z?

$
0
0

Hello All,

I'd like to know the projected distance on current view. I tried Point3dProjectToPlane3d but failed still. Can anyone help? Thanks a lot!

Sub test()
    Dim MyView As View
    Dim TempDistance As Double
    Dim RangeLow As Point3d, RangeHigh As Point3d
    Dim MyPlane As Plane3d

    Set MyView = CommandState.LastView
    MyPlane.Normal = MyView.rotation.RowZ
    RangeLow = Point3dProjectToPlane3d(Point3dFromXYZ(0, 0, 0), MyPlane)
    RangeHigh = Point3dProjectToPlane3d(Point3dFromXYZ(1, 2, 3), MyPlane)

    TempDistance = Point3dDistance(RangeLow, RangeHigh)
End Sub

[V8i VBA] SendDataPoint method

$
0
0

The CadInputQueue.SendDataPoint method has an optional parameter Qualifier but nowhere does the documentation tell us its purpose.  Terse and enigmatic spring to mind...

SendDataPoint Method

QualifierOptional. A Long expression.

Can anyone elaborate?

Background

User wants to place a Control key-in in MicroStation's input queue.  Is that Qualifier parameter intended for that purpose?  Is there another way to place a Control key-in in MicroStation's input queue?

Pan view not working

$
0
0

I'm trying to script a vba code for pan view using two points in Power inroad v8i.

but, it always make fit view, I tried with a recorded script of Pan -hand-icon. same issue. what may be the reason.

Sub pans()
Dim pt1 As Point3d
Dim pt2 As Point3d
pt1.X = 254322.9969
pt1.y = 6140945.2428
pt2.X = 254572.967
pt2.y = 6140051.2628
CadInputQueue.SendKeyin "pan view"
CadInputQueue.SendDragPoints pt1, pt2, 1
End Sub

Viewing all 4331 articles
Browse latest View live


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