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

[CONNECT C#] Add Reference to ProjectWise dgn file

$
0
0

looking for some help or guidance on adding a model reference to a .dgn file where the files are in projectwise.

 im wondering if I should be doing this from the microstation SDK or the ProjectWise SDK. I did some googling and is seemed to be a good amount of work to do this. and someone in one of the posts suggested using a Key-in.

JD


[CONNECT C++] Text Field Redraw

$
0
0

My code creates a text field associated with an Item instance.  The text field is part of a cell.

If I modify an Item property, the text field doesn't update right away. It redraws itself eventually after I perform some user action.  I haven't figured out exactly what 'user action' triggers the redraw.

What do I need to do programmatically to trigger the redraw of a text field?  If I redraw the cell that contains the text field nothing happens.

MIcrostation V8i SS3 get Tag value c#

$
0
0

Hi,

I'm trying to get the tag value using c#.

opened the design file using OpenDesignFileForProgram.

BCOM.TagElement tele1 = _Ele.AsTagElement(); //Working fine
Console.WriteLine(tele1.TagSetName); //working fine

Console.WriteLine(tele1.TagDefinitionName); //Working fine


Console.WriteLine(tele1.Value.ToString()); //error Exception thrown: 'System.Runtime.InteropServices.COMException'

then i try to use Propertyhandler to extract the value. But, i'm not sure what is equivalent for below commands to handle element property in c#. 

Dim oPH As PropertyHandler
Set oPH = CreatePropertyHandler(ele)

[CONNECT C#] add dgn model reference using .NET and change some reference settings

$
0
0

trying to figure out how to add a dgn model reference to a file and set a attachment settings. just struggling through the SDK.

I found CreateDgnAttachment method but cant find how to set  reference settings.

here is what I have so far but after I run the code the attachment was NOT added. I don't get any errors. I think I'm missing something.

My other problem is I want to change the setting of the NewLevelDisplay. I want to set this to always. but I cant find how to set that..or really most of the attachment settings for that matter.

//testing
BD.DgnDocument dgndoc = BD.DgnDocument.CreateForLocalFile("X:\\CADDServices\\OHDOT_CONNECT\\WorkSpaces\\OHDOT\\WorkSets\\00000_JD_MISC\\400 - Engineering\\Civil\\Basemaps\\00000_BK000.dgn");
BD.DgnFileOwner fileowner = BD.DgnFile.Create(dgndoc, BD.DgnFileOpenMode.ReadWrite);
BD.DgnFile curfile = fileowner.DgnFile;
BD.DgnDocumentMoniker refDocMon = BD.DgnDocumentMoniker.CreateFromFileName("00000_BK002.dgn", "X:\\CADDServices\\OHDOT_CONNECT\\WorkSpaces\\OHDOT\\WorkSets\\00000_JD_MISC\\400-Engineering\\Civil\\Basemaps\\");

BD.StatusInt openstatus;
curfile.LoadDgnFile(out openstatus);
bool check1 = curfile.IsLoaded;
bool check2 = curfile.IsOpen;
BD.ModelIndexCollection collection = curfile.GetModelIndexCollection();
IEnumerator<BD.ModelIndex> models = collection.GetEnumerator();
while (models.MoveNext())
{//add reference to first model
    BD.StatusInt status;
    BD.DgnModel model = curfile.LoadRootModelById(out status, models.Current.Id);

    BD.DgnAttachment newatt = model.CreateDgnAttachment(refDocMon, "Design");
    newatt.Rewrite(true,true);
    break;        
}
curfile.ProcessChanges(Bentley.DgnPlatformNET.DgnSaveReason.FileClose);
curfile.Release();

any help??

JD

Macro to set angle readout precision and working units readout precision

$
0
0

When I record a macro it successfully captures and can regurgitate, effectively, an angle readout precision setting.

But the working units setting, quite analogous, is completely ignored. the macro contains nothing.

it would seem there should be a step corresponding to

 MbeSetAppVariable "DGNSET", "dgnSet.angleReadoutPrec", 9&

but there isn't. rather than guess, many times, what might be the name of

dgnSet.workingunitsReadoutPrec, .... ( 2 digits fewer than angle ..?!?!...)

can I find it documented somewhere?

F1 help doesnt know about it.

thanks

Jim

Microstation v8i SS3 Close Alert Dialogue Box

$
0
0

HI,

Anybody please help me with a piece of code to close the Alert Box using C# (Apply Yes Button)?

Thanks,

Vinoth

[CONNECT C++] Convert between Master Units and custom units

$
0
0

Is there a way, using the MicroStationAPI, to convert between MicroStation master units and supported custom units?  Delivered ECSchema Units_Schema contains numerous units, such as Acre and Hectare, together with a corresponding numeric conversion factor.  For example:

// Return requested value after converting from model's master units
double squareYards = ConvertorFunc (1234, "YARD_SQUARED", ACTIVEMODEL);

[v8i VBA] Possible to save workspace settings resulting from ActiveWorkspace.RemoveConfigurationVariable?

$
0
0

I need to remove a configuration variable from the active .ucf file.  I already tried the "remove it and add nothing" trick, as it turns out I need to 100% remove the line, not set it to "".  

The reason I need to do it is this: https://communities.bentley.com/products/microstation/f/microstation-forum/172086/v8i-error-unable-to-load-create-dialog-item-of-type-iconcmd-id-29-from-dialog-mgdshook-solutions-in-wiki-do-not-work

I'm simply going to convert our old MS_DGNMACROS list to VBA and call them from OnProjectLoad to solve this issue, since it's unlikely I'll ever figure out why having any MS_DGNAPPS in the user file breaks some seemingly unrelated menu item.  

Is there a simple way to do remove this setting through VBA, or do I need to write something to overwrite the $(_USTN_USERCFG) skipping lines that begin with "MS_DGNAPPS"?


[CE c#]how to create "construct solid tube" ?

$
0
0

HI,

[CE c#]how to create construct solid tube?  or how to use SendCommandto to create new "construct solid tube" ?

And, how to define the innor or outside diameter by keyin?

[CE C#] how to define ACS by points?

$
0
0

Hi,

How to use C# define ACS by points in CE?

[CONNECT C++] Observe element property events?

$
0
0

Is it possible to set up an observer that receives notification of element property events?

For example, if I'm interested in the area of a shape, can I receive a message that the area property has changed in response to a user modifying that shape?

[CONNECT C++] Is mdlOutput_rscMessageCenter() broken?

$
0
0

This code fragment attempts to format and print a message loaded from a resource file...

mdlOutput_rscMessageCenter (OutputMessagePriority::Info, 0, MESSAGELIST_Messages,
    MESSAGE_UseTemplateLibrary, MESSAGE_UseTemplateLibrary, OutputMessageAlert::None, libName);

WString	info;
mdlOutput_rscsPrintf (info, 0, MESSAGELIST_Messages, MESSAGE_UseTemplateLibrary, libName);
mdlOutput_messageCenter (OutputMessagePriority::Info, info.c_str (), info.c_str (), OutputMessageAlert::None);

mdlOutput_rscMessageCenter prints this for the brief message of the Message Center:

Using label template library '%s'

And prints this for the detailed message:

Using label template library '\\Asterix\DataDir\Bentley\CONNECT\LA Solutions\Standards\cell\AnnotatorTemplateLibrary.cel'

Why doesn't the brief message get formatted?

The second, more verbose, approach prints this as expected in both the brief and the detailed windows of the Message Center:

Using label template library '\\Asterix\DataDir\Bentley\CONNECT\LA Solutions\Standards\cell\AnnotatorTemplateLibrary.cel'

Have I missed something in mdlOutput_rscMessageCenter?

How to set GraphicGroup in element .NET AddIn, plus complaint about Documentation (actually these are two subjects, should I make then different posts? well, they're related)

$
0
0

Win10, MicroStation CONNECT Update 10, VS 2017 Communities, C# .NET AddIn


Hi there,

I am an oldfashioned MicroStation programmer, and now busy with a small pilot to try some functionality in Mst CONNECT C# .NET AddIn.
Now, I seem to be unable to place a linestring having a next graphicgroup. I am not able to find out how to set the graphicgroup in the element to
be created.

I have found:
Bentley.MstnPlatformNET.Settings.CurrentGraphicGroup += 1;

But for example my Bentley.DgnPlatformNET.LineStringElement that I created does not seem to have some property GraphicGroup or so.
How to set it, in the element to be Added? Somebody please?

Related, I have a complaint about documentation, as for .NET. I have:
DgnPlatformNet.chm
MicroStationAPI.chm (for usage through Interop)
MSTNPlatformNET.chm

They certainly add value, in that you can search them and sometimes find something. and together with having luck in searching examples,
sometimes there is joy.
But they are basically some auto generated stuff lacking many details. Basically you see the same things that you see in Intellisence in Visual Studio.
without too much of an explanation.

For example I do not see for "OnDataButton" what the return value does;
some example says "return false" so I return false. But what is it for, what happens if I return true, these kind of explanations are lacking
(this is just an example, I do not need this precise explanation for now).

For example I do not see, from documentation, how to access "Fence", to get it´s contents. From some old stuff I had, yes I get something:
public static Bentley.Interop.MicroStationDGN.Application s_App;
s_App = (Bentley.Interop.MicroStationDGN.Application)System.Runtime.InteropServices.Marshal.GetActiveObject(
"MicroStationDGN.Application");
s_App.ActiveDesignFile.Fence
ElementEnumerator elmsEnumerator = Cinca.s_App.ActiveDesignFile.Fence.GetContents();
and ok it works,

but if it were for documentation, I am nowhere. Some more description, a mention of how to be able to access the method or property, a small
example would be welcome.

(The MSTNPlatformNET.chm, every now and then, has slightly some more text than DgnPlatformNET.chm, sometimes it has "Remarks").

best regards, Jan Willem de Pater

[CONNECT .NET] How to associate a Picklist with an ItemType Property?

$
0
0

I can see classes ItemType and Picklist in MstnPlatformNET help.  What I can't see is the way to associate a Picklist with an ItemType property.  That is, how do I write code that informs MyItemType.MyProperty that its values should be restricted to those specified in MyPicklist?

[CONNECT .NET] CONNECT Update 11 SDK: Build ManagedItemTypesExample fails in Visual Studio

$
0
0

I can open the MicroStation CONNECT Update 11 SDK command window and invoke BuildAllExamples.bat successfully.

If I change to folder \Annotatation\ManagedItemTypesExample and execute openSln.bat in the same SDK command window then Viz Studio opens and loads that project.

However, when I build that project in Viz Studio the build fails.  Viz Studio complains that it can't create temporary files in

...\SDK\examples\Annotations\ManagedItemTypesExample\obj\Debug

If I create those folders (obj, Debug) manually then Viz Studio builds successfully.


In Microstation V8i, is it possible to use a native MDL program (.ma + .dll) as a shared library and how?

$
0
0


Hi,

In pure MDL, dls file specification (see below) allows to call functions in MDL program (used as Shared library) from another pure MDL program.
How may this be done between two "native" MDL programs?


Thanks for help

Best regards,

Jean-Claude

/*----------------------------------------------------------------------+
| |
| Function - |
| |
| MDL Shared Library Example Application Dynamic Link |
| Specification File |
| |
+----------------------------------------------------------------------*/
/* Specify the version number. */

%Version 0x551

%InterfaceType Mdllib

%ModuleName pixdted

%Functions

GetPointAltitudeFromDtedUsingDisplayedRaster (dtTools_GetPointAltitudeFromDtedUsingDisplayedRaster)
GetPointAltitudeFromDted (dtTools_GetPointAltitudeFromCurrentSousLotDted)

%EndFunctions

%Variables

%EndVariables


%End

[CONNECT .NET, C++] ItemTypeLibrary Create (string name, DgnFile dgnfile, bool forCopy)

$
0
0
public static ItemTypeLibrary Create (
  string name,
  DgnFile dgnfile,
  bool forCopy);

What is the purpose of the final argument forCopy in that method declaration?  There's a similar method in the C++ class, with a similar absence of explanation in the help doc.

[CONNECT C++] Create custom IECInstance formatter for ItemType property

$
0
0

I have existing code that creates an IECInstance formatter for the area property of my Item Type. 

bool    CreateAreaFormatter  (IECInstancePtr&                 formatInstance,
                             int                              nUnits,
                             int                              accuracy,
                             Annotator::AreaDecoratorOptions  decorator)  
{
  ECN::ECSchemaPtr      formatSchema;
  if (SchemaFactory::GetMstnPropertyFormatterSchema (formatSchema))
  {
    WCharCP                 AreaClassName { L"AreaClass" };
    ECN::ECClassCP          formatClass   { formatSchema->GetClassCP (AreaClassName) };
    StandaloneECEnablerP    enabler       { formatClass->GetDefaultStandaloneEnabler () };
    StandaloneECInstancePtr localInstance { enabler->CreateInstance () };
    if (localInstance.IsValid ())
    {
      WCharCP        PropUnits       { L"Units" };
      ECValue        units           { nUnits };
      localInstance->SetValue (PropUnits, units);
      WCharCP        PropAccuracy    { L"Accuracy" };
      ECValue        valAccuracy     { accuracy };
      localInstance->SetValue (PropAccuracy, valAccuracy);
      WCharCP        PropUnitDecorator  { L"UnitDecorator"  };
      ECValue        valDecorator    { decorator };
      localInstance->SetValue (PropUnitDecorator, valDecorator);

      formatInstance  = localInstance;
    }
  }
  return formatInstance.IsValid ();
}

That uses the information in ECSchema..\MicroStation\ECSchemas\Standard\Units_Schema.01.00.ecschema.xml to obtain numeric conversions and labels.

Formatted Area Labels

I would like to create formatter for hectares.  Hectares are commonly used in Europe and rest of world to measure area.  Hectares are similar in scale to acres, used in the US.  Unfortunately, Hectares are not included in that Unit_Schema.

Can I simply add Hectares to that Unit_Schema?  I guess that I could, but prefer not to modify the delivered files.  Can I write my own IECInstance formatter?  How would I go about that?

Batch file to run batch process -wabatchprocess

$
0
0

I have a batch script to run a batch process in AECOsim but it is starting up Energy Simulator. Am I am to pass in a project config file to -wabatchprocess?

Echo Starting

Start /wait "batch" CMD /c aecosimbuildingdesigner.exe -wabatchprocess "-iF:\IOP\EW\02_Plant\03_Design\99_Admin\_Sandbox\Scripts\EW_Sync_000_Dynamic.bprc"

Echo Done

How do I edit this excellent little routine I recorded so that it returns to the beginning again?

$
0
0

How do I edit this excellent little macro I recorded so that it returns to the beginning again?

This VBA takes text from one instance and copies it into another in just two clicks but in order for it to function, I have to keep clicking the menu button I have it assigned to.
I want to be able to use it again straight away on two other pieces of text without clicking the button again until I 'reset' or 'choose nothing'.

something like 'goto Sub BmrCOPY_TEXT_SAME()'??

Sub BmrCOPY_TEXT_SAME()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long
Dim oMessage As CadInputMessage

' Send a keyin that can be a command string
CadInputQueue.SendKeyin "TEXTEDITOR MODIFY "

' Pause macro playback for user input of a datapoint.
startPoint = CadInputQueue.GetInput(msdCadInputTypeDataPoint).point
CadInputQueue.SendDataPoint startPoint, 1

' XX-MacroComment_Header-XX

' Start a command
CadInputQueue.SendCommand "TEXTEDITOR PLAYCOMMAND COPY"

' Pause macro playback for user input of a datapoint.
startPoint = CadInputQueue.GetInput(msdCadInputTypeDataPoint).point
CadInputQueue.SendDataPoint startPoint, 1

CadInputQueue.SendCommand "TEXTEDITOR PLAYCOMMAND PASTE"

' Pause macro playback for user input of a datapoint.
startPoint = CadInputQueue.GetInput(msdCadInputTypeDataPoint).point
CadInputQueue.SendDataPoint startPoint, 1

CommandState.StartDefaultCommand
End Sub

Viewing all 4331 articles
Browse latest View live


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