Hello,
I would like to automate itemtype property assignment.
To do that, I'm trying to write a small piece of VBA but it seems no functions are available for this usage in the VBA API.
As an old Microstation user, I know we can replace some piece of code by key-ins in many case. I'm going to the macro recorder to see which key-ins I must use and I have something like this :
Sub BmrITEMTYPE()
Dim point As Point3d
CadInputQueue.SendKeyin "MDL KEYIN Bentley.CustomProperties, Bentley.CustomProperties ITEMTYPE ATTACH"
CadInputQueue.SendKeyin "ITEMTYPE SETTINGS DESELECTALL "
CadInputQueue.SendKeyin "ITEMTYPE SETTINGS SELECT Architectural\Stairs"
' Les coordonnées sont en unités principales
point.X = 0.0point.Y = 0.0point.Z = 0.0
' Envoyer un point données à la commande actuelleCadInputQueue.SendDataPoint point, 1
CadInputQueue.SendKeyin "ITEMTYPE SETTINGS SETVALUE Type abc"
' Envoyer une réinit à la commande actuelle CadInputQueue.SendReset
CommandState.StartDefaultCommand
End Sub
This macro works on the selected element and the itemtype Architectural\Stairs is correctly attached BUT the value "abc" is not set to the "Type" property.
I have tried manually and it's exactly the same : the property is not modified!
Anybody have an idea to solve this ?
Many thanks in advance !
Philippe
Hi Philippe,
in my opinion there is no simple solution for this now. To simulate users' key-ins is not recommended and key-ins captured by Macro Recorder are not documented anywhere, so there is no confirmation they should work.
But maybe the problem is depper than in using key-ins: I tried to set ItemType value using VBA PropertyHandler, which is correct and recommended way how to work with not standard element properties, but it doesn't work also. I found this bug some time ago, but it seems it was not repaierd in Update 1 yet.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:I found this bug some time ago, but it seems it was not repaierd in Update 1 yet
In another (private) thread, BDN tell us that there will be no SDK for MicroStation CONNECT Update 1: we must continue to use the existing SDK. A revised SDK may be published after Update 2. There is no timescale announced.
Regards, Jon Summers LA Solutions
Hi Jon,
Unknown said:In another (private) thread, BDN tell us that there will be no SDK for MicroStation CONNECT Update 1: we must continue to use the existing SDK. A revised SDK may be published after Update 2. There is no timescale announced.
In my opinion it's off-topic answer. My finding has been about VBA access to ItemTypes using PropertyHandler and VBA is native part of MicroStation, not part of SDK libraries, so there is not any dependency if SDK for Update 1 is available or not.
Unknown said:In my opinion it's off-topic answer
I was providing background information for your statement:
Unknown said:I found this bug some time ago, but it seems it was not repaired in Update 1 yet
VBA is a wrapper around the native APIs. If there's been no update to those then we can't expect VBA to be different.
What happens if you attempt to set an element property using the native APIs?