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

[Connect C++] Get the enter Data Field from a text element

$
0
0

Hi everybody,

In V8i, I used this code to get the enter Data Field from a text element

TextEDParam edParam;
mdlText_extract(NULL, NULL, NULL,NULL,NULL,NULL, &edParam, &ElmDscrDebP->el);

Of course I could include <Mstn\MdlApi\deprecated10_0.fdf>

But I would like to use the new API of text but I didn't find the equivalent for the EnterDataFields in the documentation...
Can someone help me?

Regards,

Hervé


Microstaiton MVBA

$
0
0

I am the Newbie of Microstation VBA, i have the working code in MVBA, running through batchprocess.

i want run through excel sheets command button, because i want to bypass the batchprocess. Below is the code,

Sub Text_Find_Replace()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim lngTemp As Long

Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim cellDict As Object
Dim LastRow As Long
Dim x, cellName
Dim x1 As Single
x1 = Timer
txtfinder = Array("-f1ine", "ST 25-Quo")
txtreplacer = Array("Fine", "ST 25-QUO")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set txtDict = CreateObject("Scripting.Dictionary")

Dim dgnFile As DesignFile
Dim application As application
Set application = New MicroStationDGN.application
Set dgnFile = application.ActiveDesignFile

Dim scanCriteria As New ElementScanCriteria

CadInputQueue.SendCommand "MDL KEYIN FINDREPLACETEXT"

CadInputQueue.SendKeyin "FIND DIALOG SEARCHINCELLS True"
CadInputQueue.SendKeyin "FIND DIALOG REGEX True"
CadInputQueue.SendKeyin "FIND DIALOG WHOLEWORDS True"
CadInputQueue.SendKeyin "FIND DIALOG MATCHCASE True"
CadInputQueue.SendKeyin "FIND DIALOG PAN True"
CadInputQueue.SendKeyin "FIND DIALOG ROTATE True"
CadInputQueue.SendKeyin "FIND DIALOG ZOOM True"
CadInputQueue.SendKeyin "FIND DIALOG ZOOMLEVEL 5"

For icntr = 0 To 56 Step 1


findtext = "FIND DIALOG SEARCHSTRING " & txtfinder(icntr)
ReplaceText = "FIND DIALOG REPLACESTRING " & txtreplacer(icntr)

CadInputQueue.SendKeyin findtext
CadInputQueue.SendKeyin ReplaceText
CadInputQueue.SendKeyin "FIND DIALOG REGEX False"
CadInputQueue.SendKeyin "FIND DIALOG REGEX True"
CadInputQueue.SendKeyin "CHANGE TEXT ALLFILTERED"
CadInputQueue.SendCommand "SAVE DESIGN"
CommandState.StartDefaultCommand

Next

CadInputQueue.SendCommand "FIT VIEW EXTENDED 1"
End Sub

[V8i VBA] Change reference file name and path? (Bonus if I can figure out user forms)

$
0
0

We have received a number of files from another firm so that we can finish the design they started. We (I) need to re-path the references to match our directory/drive setup. For most of these, it's not too bad, but there are a few files (cross section sheets) that have hundreds of attachments (duplicates of the same couple of references). In addition to the references needing the path changed, a couple of the files (borders, mainly) have been renamed in this transition (for reasons) so even if I could get the path "right" the file as previously named no longer exists. We don't use project configurations yet (working on it) so CFG variables won't really help me.

I thought this would be a great opportunity to dust off my (very rusty) VBA skills. It might just take me less time to write a macro than it would take to repath 200-300 references by hand. Since the attachments are actually just the same three files, over and over again, I thought I could do something like this.

Scan the file for attachments, enumerate and construct an array of attachments
Create a list of attachment file names (discarding duplicates)
Populate a list box (?) with the file names
Select a file to replace/repath -> OK
Open a file explorer dialog to browse to the replacement file
step through the array of attachments and change the reference attachment from the old file to the new file. Keep stepping.
Select the next file to replace.
Repeat until finished.

Some of this I know I know how to do some of it I think I know how to do, but the interaction with the user forms in the MicroStation VBA environment is fuzzy to me.

Is there anything wrong with my thought process? Any suggestions, or known issues?
Thank you.

MaryB

Link cell with textfields to element with items

$
0
0

Hi,

this is something I was wondering about for a long time now. It seems that I never found the right terms to search for, neither in this forum nor in the documentation.

I really like the Item Types in the Microstation Connect Edition. Handling, dgnlib support, entering instance data, etc.. all fine! But when it comes to displaying that data in the drawing we have to use labels to associate a cell with textfields to the the element, right? I got it working but...

I'm not fully statisfied with the features of labels. Thats why I would like to try to code some tool which would allow me to "associate" the item data of an element to a manually created cell with textfields in it. So that I could use plain cells for my annotation and have them update when item data changes. Why? Because:

  • with cells I can have elements on different layers
  • placing labels sometimes feels a little confusing (working, not working,...)
  • scale cell before placing
  • maybe some algorithms to replace cells and "keep" association

I have seen tools that do these kind of things, though I'm not sure whether they are using item data.

Can someone please give me a hint with what kind of technology of the SDK I could accomplish this kind of work?

That would be really great! Thanks in advance.

Stephan

Multi-View Rendering (45 views)

$
0
0

(cross posting from MicroStation general forum as recommended)


Hello everyone!

I'm new to MicroStation, but I was hoping I could get some help with a question. I'm looking to write a plugin that can do multi-view rendering for a lenticular system. I'd need to be able to render each view to a framebuffer, changing the camera's view and projection matrix for 45 views in total, and then run a post-process shader on that before sending it to the screen. Is this level of control possible with MicroStation's SDK? We already have plugins like this for Unity, Blender, and other 3D software, but I'm curious if this sounds feasible to anyone experienced with MicroStation's SDK.

Thanks in advance for any insight you can offer!

[Microstation v8i] Start with a VBA file loaded

$
0
0

Good morning,

is it possible start a determinate (I mean not everyone) .DGN file with a determinate .MVBA project?

I wish to create a .DGN file (with some starting lines) and save it in seed folder (like an Excel model) and I'd like, when users create a new .DGN file with that seed, that file has already loaded one (or more) .MVBA prject.

Thanks a lot.

BR,

Paolo Maggiani

[Microstation v8i] Align numbers. Tool or VBA?

$
0
0

Good morning,

is there a Microstation tool to align numbers on comma (and purple dot line) as showed in the attached picture?

I wish to quickly align numbers maybe with a tool (if it exists) or have I to develop a macro?

BR,

Paolo

Point3dInPolygonXY error "byref"

$
0
0
Hello, I am looking for some explanation on the use of "Point3dInPolygonXY".

I have this code:

Dim ElEnum, ElEnum2 As ElementEnumerator
Dim El, El2 As Element
Dim res As Long
Dim point, points() As Point3d
Dim id As DLong
Dim SPoint, Epoint As Point3d

Set ElEnum = ActiveModelReference.GetSelectedElements
ElEnum.Reset

While ElEnum.MoveNext
    Set El = ElEnum.Current
    
    If El.Type = 12 Then
        Set ElEnum2 = El.AsComplexElement.GetSubElements
        ElEnum2.MoveNext
        Set El2 = ElEnum2.Current
        SPoint = El2.AsLineElement.startPoint
        Epoint = El2.AsLineElement.EndPoint
    End If
    
    If El.Type = 6 Then
        points = El.AsShapeElement.GetVertices()
        res = Point3dInPolygonXY(SPoint, points)
    End If
    
Wend

if i run it, i have an error type "byref" in "Set res = Point3dInPolygonXY(SPoint, points)"
Could someone explain my error to me?

E.D


Boolean Union of Solids - error in MicroStation Connect Edition SDK

$
0
0

I have attached 2 MicroStation Connect Edition files represention a double curved bridge deck defined in our IBDAS model by BOXES, each BOX defined by 6 box sides each represented by NURBS-surface:

1. SmartSolid.dgn : each box represented by a SmartSolid.

2. SmartSolidApiUnite.dgn: each box represented by a SmartSolid. Boolean Union in SDK are used to union all boxes. Boxes are added to unions one by one and in case a box cannot be added to any existing union
a new union is introduced. It is very easy to see that the SDK dosent work. Same of the boxes disappear - Why? The SDK operations does not reflect error conditions.

You can try to simulate the SDK process just by interactively do the same operations (Unite) in MicroStation Connect Edition using SmartSolid.dgn.communities.bentley.com/.../SmartSolidApiUnite.dgncommunities.bentley.com/.../SmartSolid.dgn

You can try to simulate the SDK process just by interactively do the same operations (Unite) in MicroStation Connect Edition using SmartSolid.dgn.communities.bentley.com/.../SmartSolidApiUnite.dgncommunities.bentley.com/.../SmartSolid.dgn

BR

Peder

VBA Propertyhandler SetValue TextString ReadOnly

$
0
0

Hi everyone,

I am trying to use the propertyhandler to change a value of one text node element.

Everything goes fine except for the last step which is changing the value to the string that I need.

I tried the "Height" instead of the "TextString" and it worked perfectly; however, I get the below message when I use the "TextString"

Below is the code I am using for this.

Dim ele As TextNodeElement
Set ele = elements.Current

Dim oPH As PropertyHandler
Set oPH = CreatePropertyHandler(ele)

oPH.SelectByAccessString ("TextString")
oPH.SetValue ("Hello World!")

Any idea of why this is ready only?

Thanks in advance.

Find if a point is between two lines?

$
0
0

HI All

I want to know is there a function to find that if a point is between two lines?

[CONNECT C++] replacing instance on element using ScheduleReplaceInstanceOnElement - what am I missing

$
0
0

Hi

I am trying to read the value of an existing Item and make some changes to it and then replace my instance with the new edited version. I am using InstanceReadStatus iReadStatus = wipInstance.ReadFromXmlString(iecInstancePtr, xml6.c_str(), *ecReadContextPtr); to read and ecEnabler->ScheduleReplaceInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, *elemRef->GetDgnModelP(), ehandle, uLocalId);//*ACTIVEMODEL, ehandle, uLocalId); to replace the instance. So far with no luck on the replacement part :-(

My code looks like this:

if (opdater)
{
  ECN::ECSchemaPtr pSchema;
  std::wstringstream xml5;
  boost::property_tree::xml_parser::write_xml_element(xml5, {}, pt, -1, xml_writer_settings<wptree::key_type>{});
  Bentley::WString xml6 = xml5.str().c_str();
  ////xmlInstanceApi.UpdateInstance(status, Bentley::WString(xml3.c_str()));
  ///// Først finder vi schema på instansen ved at finde schema på class'en
  WString wsClass = instP->GetClass().GetName();
  if (wsClass.length() > 0)//|| wsClass.CompareTo(L"ECQUERY_PROCESS_SearchAllClasses"))
  {
	DgnECManagerR ecMan = DgnECManager::GetManager();
 	SchemaInfo schemaInfo(ECN::SchemaKey(wsClass.GetWCharCP(), 1, 0), *ISessionMgr::GetActiveDgnFile());///L"skelpunkt1", 1, 0), *dgnfilePtr);
	pSchema = ecMan.LocateSchemaInDgnFile(schemaInfo, ECN::SchemaMatchType::SCHEMAMATCHTYPE_LatestCompatible);
	//if (!intName.IsNullOrEmpty(intName.GetWCharCP()))
 	//  ECN::ECClassCP pVolClass = pSchema->GetClassCP(intName.c_str());//(L"Sofa").c_str
  }	
  ECInstanceReadContextPtr ecReadContextPtr = schemaManager.CreateECInstanceReadContext(*pSchema, *ISessionMgr::GetActiveDgnFile());
  // Find the ECEnabler that is handling a PropertiesClass in the dgn file.
  // Findes højere oppe i koden DgnECInstanceEnablerP ecEnabler = DgnECManager::GetManager().ObtainInstanceEnabler(instP->GetClass(), *ISessionMgr::GetActiveDgnFile());//*ecClass, *ISessionMgr::GetActiveDgnFile());
  //Gets a StandaloneECInstance to be used as a template when creating new persistent ECInstances.
  StandaloneECInstanceR wipInstance = ecEnabler->GetSharedWipInstance();
  /// Læse xml-streng til instance
  /// Lav en instancepointer, som vi kan knytte data fra xml'en til
  IECInstancePtr iecInstancePtr;
  /// Læse xml-streng til instance
  InstanceReadStatus iReadStatus = wipInstance.ReadFromXmlString(iecInstancePtr, xml6.c_str(), *ecReadContextPtr);
  if (iReadStatus != INSTANCE_READ_STATUS_Success)
    OutputDebugString(L"Create Text - Oh no - der er noget galt med wipInstanceReadFromXmlString");
  /// Opret en PropertiesClass instance på det element vi vil opdatere
  DgnElementECInstancePtr s_propertiesClassInstance = nullptr;
  DgnElementECInstanceCP elemInstance = instP->GetAsElementInstance();
  UInt32 uLocalId = elemInstance->GetLocalId();
  DgnECInstanceStatus dgnECInstancestatus = ecEnabler->ScheduleReplaceInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, *elemRef->GetDgnModelP(), ehandle, uLocalId);//*ACTIVEMODEL, ehandle, uLocalId);///->CreateInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, eh);
  if (dgnECInstancestatus == DGNECINSTANCESTATUS_Success)
  {
	ehandle.ReplaceInModel(ehandle.GetElementRef());
	OutputDebugString(L"WriteChanges er: SLÅET FRA");// +sWrite);								
  }
  else
    OutputDebugString(L"Fejl i oprettelsen af instance, fejlkode: " + dgnECInstancestatus);
    }
	} ///for each (DgnECInstancePtr instP in instanceIter)

I am doing something wrong. Reading the xml seems to be ok:

(here I ill add a screendump shortly)

And the ScheduleReplaceInstanceOnElement also seem to be ok, but nothing happens. Am I supposed to rewrite either the element or the instance or?

(here I ill add a screendump shortly)

I have tried a million things but so far with no luck. I could of course also delete the instance and then rewrite it.

if (opdater)
{
  ECN::ECSchemaPtr pSchema;
  std::wstringstream xml5;
  boost::property_tree::xml_parser::write_xml_element(xml5, {}, pt, -1, xml_writer_settings<wptree::key_type>{});
  Bentley::WString xml6 = xml5.str().c_str();
  ////xmlInstanceApi.UpdateInstance(status, Bentley::WString(xml3.c_str()));
  ///// Først finder vi schema på instansen ved at finde schema på class'en
  WString wsClass = instP->GetClass().GetName();
  if (wsClass.length() > 0)//|| wsClass.CompareTo(L"ECQUERY_PROCESS_SearchAllClasses"))
  {
	DgnECManagerR ecMan = DgnECManager::GetManager();
	SchemaInfo schemaInfo(ECN::SchemaKey(wsClass.GetWCharCP(), 1, 0), *ISessionMgr::GetActiveDgnFile());///L"skelpunkt1", 1, 0), *dgnfilePtr);
	pSchema = ecMan.LocateSchemaInDgnFile(schemaInfo, ECN::SchemaMatchType::SCHEMAMATCHTYPE_LatestCompatible);
	//if (!intName.IsNullOrEmpty(intName.GetWCharCP()))
 	//  ECN::ECClassCP pVolClass = pSchema->GetClassCP(intName.c_str());//(L"Sofa").c_str
  }	
  ECInstanceReadContextPtr ecReadContextPtr = schemaManager.CreateECInstanceReadContext(*pSchema, *ISessionMgr::GetActiveDgnFile());
  // Find the ECEnabler that is handling a PropertiesClass in the dgn file.
  // Findes højere oppe i koden DgnECInstanceEnablerP ecEnabler = DgnECManager::GetManager().ObtainInstanceEnabler(instP->GetClass(), *ISessionMgr::GetActiveDgnFile());//*ecClass, *ISessionMgr::GetActiveDgnFile());
  //Gets a StandaloneECInstance to be used as a template when creating new persistent ECInstances.
  StandaloneECInstanceR wipInstance = ecEnabler->GetSharedWipInstance();
  /// Læse xml-streng til instance
  /// Lav en instancepointer, som vi kan knytte data fra xml'en til
  IECInstancePtr iecInstancePtr;
  /// Læse xml-streng til instance
  InstanceReadStatus iReadStatus = wipInstance.ReadFromXmlString(iecInstancePtr, xml6.c_str(), *ecReadContextPtr);
  if (iReadStatus != INSTANCE_READ_STATUS_Success)
	OutputDebugString(L"Create Text - Oh no - der er noget galt med wipInstanceReadFromXmlString");
  /// Opret en PropertiesClass instance på det element vi vil opdatere
  DgnElementECInstancePtr s_propertiesClassInstance = nullptr;
  DgnElementECInstanceCP elemInstance = instP->GetAsElementInstance();
  UInt32 uLocalId = elemInstance->GetLocalId();
  DgnECInstanceStatus dgnECInstancestatus = ecEnabler->ScheduleReplaceInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, *elemRef->GetDgnModelP(), ehandle, uLocalId);//*ACTIVEMODEL, ehandle, uLocalId);///->CreateInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, eh);
  if (dgnECInstancestatus == DGNECINSTANCESTATUS_Success)
  {
	ehandle.ReplaceInModel(ehandle.GetElementRef());
 	OutputDebugString(L"WriteChanges er: SLÅET FRA");// +sWrite);								
  }
  else
	OutputDebugString(L"Fejl i oprettelsen af instance, fejlkode: " + dgnECInstancestatus);
}
} ///for each (DgnECInstancePtr instP in instanceIter)

It is this call I don't understand:

DgnECInstanceStatus dgnECInstancestatus = ecEnabler->ScheduleReplaceInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, *elemRef->GetDgnModelP(), ehandle, uLocalId);//*ACTIVEMODEL, ehandle, uLocalId);

I am finding it difficult to understand what is connected to the element and what is connected to the element-instance on the element, which also can be treated as a element (instP->GetAsElementInstance()).

Help says:

//! Schedules the replacement of an existing instance associated with an element that is identified by the localid. The element is identified by an EditElementHandle. 
    //! @param[out] dgnecInstance   DgnECInstance that is created.
    //! @param[in]  wipInstance     A ECN::StandaloneECInstance that was probably a "shared" instance with its memory shared with a managed ECDInstance.
    //! @param[in]  modelRef        The modelRef to be used by the returned DgnECInstance. Typically you should pass *elementRef.GetDgnModelP().
    //!                             The exception is if you will be using the returned DgnECInstance to create an ECRelationship to another
    //!                             DgnECInstance that does not reside in the same DgnModel. In that case, you must pass the DgnModelRef of the
    //!                             particular attachment that will be used by that ECRelationship.  See docs for DgnECManager::CreateRelationship.
    //! @param[in]  eh              The element on which to persist the newly-created DgnECInstance
    //! @param[in]  localId         Identifies the existing instance to replace. Typically the xattribute id.
    DGNPLATFORM_EXPORT DgnECInstanceStatus   ScheduleReplaceInstanceOnElement (DgnElementECInstancePtr* dgnecInstance, ECN::IECInstanceCR wipInstance, DgnModelRefR modelRef, EditElementHandleR eh, UInt32 localId) const;

I am finding it difficult to create a good description as I honestly don't understand what it is I don't understand :-)

The code where I create an instance (which works) looks like this:

  //xmlInstanceApi.CreateInstance(status, newDescr->h.elementRef, xml);
  ECInstanceReadContextPtr ecReadContextPtr = schemaManager.CreateECInstanceReadContext(*pSchema, *ISessionMgr::GetActiveDgnFile());
  DgnElementECInstancePtr s_propertiesClassInstance = nullptr;
  /// Vi finder Class/tabel, som schema'et peger på, denne er oprettet i vores skema()-funktion
  ECClassP ecClass = pSchema->GetClassP(schema.name);
  if (ecClass == nullptr)
  {
 	WString wsTemp = L"Addinstance - Ups der er noget galt med ecClass!";
	OutputDebugString(wsTemp.c_str());
	return;
  }
  /// Find the ECEnabler that is handling a PropertiesClass in the dgn file.
  DgnECInstanceEnablerP ecEnabler = DgnECManager::GetManager().ObtainInstanceEnabler(*ecClass, *ISessionMgr::GetActiveDgnFile());
  //Gets a StandaloneECInstance to be used as a template when creating new persistent ECInstances.
  StandaloneECInstanceR wipInstance = ecEnabler->GetSharedWipInstance();
  /// Lav en instancepointer, som vi kan knytte data fra xml'en til
  IECInstancePtr iecInstancePtr;
  /// Læse xml-streng til instance
  InstanceReadStatus iReadStatus = wipInstance.ReadFromXmlString(iecInstancePtr, xml.c_str(), *ecReadContextPtr);
  if (iReadStatus != INSTANCE_READ_STATUS_Success)
    OutputDebugString(L"Create Text - Oh no - der er noget galt med wipInstanceReadFromXmlString");
  // Opret en PropertiesClass instance på det element vi er ved at danne
  DgnECInstanceStatus dgnECInstancestatus = ecEnabler->CreateInstanceOnElement(&s_propertiesClassInstance, *iecInstancePtr, ehandle);
  if (dgnECInstancestatus != DGNECINSTANCESTATUS_Success)
	OutputDebugString(L"Fejl i oprettelsen af instance, fejlkode: " + dgnECInstancestatus);
  if (elementType == 2)
  {
    updateNumber();
  }
} // if (schema.ecproperties.count(-1)!=0)
ElementTemplateNodePtr templateP; // ElementTemplateP templateP;
templateP = ElementTemplateUtils::GetReferencedTemplate(ehandle.GetElementRef());//temp->h.elementRef);
if (templateP != NULL) // if (SUCCESS != mdlElementTemplate_loadFromElement(&templateP, ehandle.GetElementRef(), ACTIVEMODEL)) 
{
  MstnElementTemplateMgr::ApplyElementTemplateParams(ehandle, *templateP); // if (SUCCESS == mdlElementTemplate_applySymbology(templateP, ehandle)) 
  if (BSISUCCESS == MstnElementTemplateMgr::ScheduleTemplateReferenceAttachment(ehandle, *templateP)) //if (SUCCESS == mdlElementTemplate_scheduleTemplateReferenceAttachment(templateP, ehandle)) 
    ehandle.ReplaceInModel(ehandle.GetElementRef());
} // hvis templateP ikke er null

I Hope someone can push me in the right direction :-)

Best regards

Bo.

[C# CONNECT] Point at distance along element

$
0
0

In COM programming most of the element types had a PointAtDistance method, I'm trying to find the same type of functionality in the DgnPlatformNET way of doing things. I've looked at the different element types & CurveVector object and can't find anything. Any ideas?

Monitoring Microstation print queue in a VB.NET software.

$
0
0

I want to create a software in VB.NET to throw a message when Microstation Application (in all the possible versions) is printing a file (In Windows 7).

This can be done by monitoring the Windows default if Microstation is printing a file using a windows driver. But windows print queue is not updating when Microstation is printing a file using a Bentley driver.

Please help me to solve this problem. Thanks for reading.

[CONNECT C++] Database API Introduction

$
0
0

posted a blog about database connecting with C++ and CONNECT.  It's good to see an example for that neglected corner of MicroStation!

This code using the mdlDB_api is very procedural.  Not a lot different to examples published decades ago for MicroStation/J!  Is an object-oriented C++ or .NET API likely to appear for database interfacing?


visual basic .net and MicroStation Connect

$
0
0

What references do I need to get this application working with MicroStation Connect.  I'm currently referencing Bentley MicroStation 1.x Object Library 10.1.  Application works fine with SS2 and SS3.

scanning cell library

$
0
0

I am trying write a VBA app to scan a cell library to substitute fonts and levels in cells. I have written code to get into a DGN file and modify cells' fonts and levels and it works, but when I tried opened a cell library like a DGN fileand run the app it won't work.  The app won't iterate thru' cells like it does for a DGN file.  The Element Enumerator won't  return cells. It just returns msdElementTypeDesignFileHeader, msdElementTypeTypeTable, msdElementTypeMicrostation, msdElementTypeViewGroup, msdElementTypeDgnStoreHeader. I thought the app will work the same way in a opened cell library file as it does an opened a DGN file.  Am I wrong in assuming this?  Does anyone know if this could be done and how to do it either in VBA or MDL?

VBA Code Modify Text Attributes

$
0
0

Hi all, could anyone help me with a VBA code to perform the following scenarios?

  • All text in the level <EXI_410> in my design file must be changed having the following attributes:

Font = ENGINEERING (3)
Height = 1.4
Width = 1.4
Justification = CenterCenter

  • All text in the level <EXI_635> in my design file must be changed having the following attributes:

Font = ENGINEERING (3)
Height = 0.8
Width = 0.8
Justification = CenterCenter

My Design Files could have a huge amount of text in different type of levels.

I've also tried to record some simple macros, but the result is not what I need. My macro only records commands to check/uncheck the boxes in the Change Text Attributes tool and modify my text with those attributes that are already by default. I've not figured out yet how to change those attributes (font, size, justification) with mine in the code.

Bentley Microstation V8i (SELECTSeries 3) 08.11.09.578

Thank u in advance! 

Below u can find my recorded macro for one type of text:

Sub ChangeTextAtt()
    Dim startPoint As Point3d
    Dim point As Point3d, point2 As Point3d
    Dim lngTemp As Long'   Start a command
    CadInputQueue.SendCommand "MDL SILENTLOAD SELECTBY dialog"

    CadInputQueue.SendCommand "DIALOG SELECTBY"

    CadInputQueue.SendCommand "SELECTBY LEVEL EXI_410"

    CadInputQueue.SendCommand "SELECTBY LEVEL EXI_410"'   Set a variable associated with a dialog box
    SetCExpressionValue "selectorGlobals.typemask[0]", 5009, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[1]", -1223, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[2]", -30, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[3]", -1, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[4]", -1, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[5]", -8257, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[6]", -257, "SELECTBY"

    SetCExpressionValue "selectorGlobals.typemask[7]", -1, "SELECTBY"'   The following statement opens modal dialog "Alert"

    CadInputQueue.SendCommand "SELECTBY EXECUTE"

    CadInputQueue.SendCommand "MDL UNLOAD SELECTBY"

    CadInputQueue.SendCommand "MODIFY TEXT"

    SetCExpressionValue "tcb->msToolSettings.changeText.font", 1, "MODIFY"

    SetCExpressionValue "tcb->msToolSettings.changeText.height", 1, "MODIFY"

    SetCExpressionValue "tcb->msToolSettings.changeText.width", 1, "MODIFY"

    SetCExpressionValue "tcb->msToolSettings.changeText.just", 1, "MODIFY"
    CommandState.StartDefaultCommand
End Sub

[MS8i SS10 C++] issue with mdlRefFile_updateReference , tying to hilite ref

$
0
0

Hello everybody,

i have files with lots of reference, and i would like to hilite all ref file.

I tried with transient but it is to slow. i tried mdllocate_hilite to slow too, i tried dispay path and also to slow , maybe because it hilites all element?

So finally I found on the forum this function : mdlRefFile_updateReference and tried this code :

  ModelRefIteratorP _IteratorP=NULL;
  DgnModelRefP ModelRef=NULL;
  if (mdlModelRefIterator_create(&_IteratorP, ACTIVEMODEL, MRITERATE_Root | MRITERATE_PrimaryChildRefs, 0) == SUCCESS)
  {
    while ((ModelRef = mdlModelRefIterator_getNext(_IteratorP)) != NULL)
    {
      mdlRefFile_updateReference(ModelRef, HILITE);
    }
    mdlModelRefIterator_free(&_IteratorP);
  }

Result :  My ref Hilited in a very fast way ! But only for 0.5 sec or less...

Question : how can I keep my ref hilited ? (like when the references dialog is open and your selected file in the list is hilited)

Thanks

RGDTS

Arnaud

[Microstation CE up12 C++] Create Parametric solids by extruding along path via c++/API

$
0
0

Hi,

It's found that sorts of API functions in SmartFeature Namespace can be used to create "Parameteric Solids" type elements. However, I tried to located a specific function which could be used to create parameteric solids by extruding along a certain as SolidUtil::Create::BodyFromSweep does, but failed.

Is that kind-of function make public to developer or please advise the method name otherwise?

Thx.

Viewing all 7260 articles
Browse latest View live


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