Does tasktoolbox open provide different or better results?
e.g. TASKTOOLBOX CLOSE;TASKTOOLBOX OPEN \Drawing
Does tasktoolbox open provide different or better results?
e.g. TASKTOOLBOX CLOSE;TASKTOOLBOX OPEN \Drawing
I searched for key-in TASKTOOLBOX in MicroStation help but failed to find it.
Stephanie Doherty:
Dim dimEl(0 To 65000) As Byte
Although it compiles, at run time it errors on the mdlDim_create call ...
An (MDL) MSElement in V8 is about 250,000 bytes. You may simply be overflowing the buffer. There are likely to be other problems when attempting to coerce VBA and MDL to work together 8-)
Jon,
I also was unable to locate any product documentation at this time and used the MicroStation keyin browser and forum as a basis/starting point to see what
additional options were available. Below is an attempt to document my findings in hopes it will help others looking to open and close custom task toolboxes in the Task Navigation Panel. Let me know if any updates or clarifications are needed.
HTH,
Bob
Keyin | Operation | |
Common | DIALOG TASKNAVIGATION [ON | OFF | TOGGLE] | Open or Close the Task Navigation Panel (Tools > Tasks) providing task navigation toolboxes a docking region |
| TASKTOOLBOX OPEN [\Task Path and Name] | Open task navigation toolbox by path in the Navigation Panel even if previously closed |
| TASKTOOLBOX CLOSE [\Task Path and Name] | Closes the specified task navigation toolbox. If no path provided closes all toolboxes |
| TASKTOOLBOX RELOAD [\Task Path and Name] | Reloads specified task navigation toolbox. If no toolbox is specified all will be reloaded |
| TASK MENU | Provide user a pop-up to select an Active task toolbox |
Less Common | TASKTOOLBOX INITIALIZE | Open and restore previously saved data if default task toolbox is not present |
| TASKTOOLBOX SHOWOPEN | Open the MicroStation Console (DOS) window and output all task toolbox Titles and Paths |
| TASKTOOLBOX VIEWMODE | Sets the task toolbox layout mode. Valid values are: "icons", "list", and "panel" |
Samples | Close all task toolboxes and display your custom/root toolbox | TASKTOOLBOX CLOSE;TASKTOOLBOX OPEN \Bentley Support Tools |
| Close all task toolboxes and display the default Drawing toolbox | TASKTOOLBOX CLOSE;TASKTOOLBOX OPEN \Drawing |
Default | Default loaded MicroStation Toolboxes | \Drawing, \Drawing Composition, \Terrain Model |
hi guyz, is there any customization that can help me autobreak a line/element when inseting a cell, by the way i have a cell to that does that but theres is a slight problem with it, the cell being placed is not in grid.
this is an example of an autocad lisp created by Lee Mac its called Automatic Block Break, does anyone here have a microstation counterpart for this program.
tnx.
proxdsgner:
I have a cell that does that but ... the cell being placed is not in grid
Robert Hook:
I also was unable to locate any product documentation at this time and used the MicroStation keyin browser and forum as a basis/starting point to see what
additional options were available
Good work!
I have this code below.
Public Function strGetLevel() As String
Dim strConfigFile As String
Dim strLine As String
Dim strList() As String
Dim strDriveLetter As StringstrDriveLetter = getDriveLetter
strConfigFile = strDriveLetter & "\VBAMacro_Config_File\VBAConfigFile.cfg"
If Dir(strDriveLetter & "\VBAMacro_Config_File\VBAConfigFile.cfg") = vbNullString Then
MsgBox "Config file path not found.", vbCritical
End
End IfOpen strConfigFile For Input As #1
Do While Not EOF(1)
Line Input #1, strLine
If Left(UCase(strLine), 10) = "LEVEL NAME" Then
strList = Split(strLine, Chr(32))
strGetLevel = strList(3)
strGetLevel = Mid(strGetLevel, 2, Len(strGetLevel) - 2)
'Exit Do
End If
LoopClose #1
End Function
In config file, I have this entry
LEVEL NAME = "EQUIPMENT-LABEL"
OFFSET VALUE = 0.1
How can I set my function to accept String and Double Inputs?
[quote user="Robert Hook [Bentley]"]
Does tasktoolbox open provide different or better results?
e.g. TASKTOOLBOX CLOSE;TASKTOOLBOX OPEN \Drawing
[/quote]
Hi Robert,
Thank you. I tried this on startup of my application. It does not open my custom toolbox. But sometimes it does.
I think tasktoolbox key-ins are not available on startup because related application may not be loaded.
Here is my code;
mdlInput_sendSynchronizedKeyin ("tasktoolbox close;tasktoolbox open \\AK SS3K",1, INPUTQ_EOQ, "");
I also tried this, but it doesn't make sense;
mdlInput_sendSynchronizedKeyin ("tasktoolbox close;tasktoolbox open \\AK SS3K",1, INPUTQ_EOQ, "tasktoolbox");
Still my application's custom icons are not visible on my custom task toolbox named AK SS3K. What is the exact time to load custom task toolbox?
When no task toolbox is open tasktoolbox key-ins is not available on key-in window. An application named tasktoolbox must be loaded first.
Regards,
Ahmet Sedat ALIS
![]()
RJ:
LEVEL NAME =
Configuration variables, like variable names in programming languages, may not contain spaces.
RJ:
LEVEL NAME = "EQUIPMENT-LABEL"
You should not quote values in a config. file. If the variable name were valid, it would now have a value "EQUIPMENT-LABEL" (including the quotes)
RJ:
How can I set my function to accept String and Double Inputs?
A configuration file contains text. There is no data typing. If you define a variable whose content, in the context of your application, should be a Double, Integer etc. then you must make that conversion in your code.
Given this in your config. file …
OFFSET_VALUE = 0.1
Get its application value in your VBA code like this …
Dim offset As Double
Const CfgVarName As String = "OFFSET_VALUE"
Dim msg As String
If ActiveWorkspace.IsConfigurationVariableDefined (CfgVarName) _
Then
Dim cfgVarValue As String
cfgVarValue = _
ActiveWorkspace.ConfigurationVariableValue (CfgVarName)
offset = CDbl (cfgVarValue)
Else
msg = "Configuration Variable '" & CfgVarName & _
"' is not defined"
ShowMessage msg, msg, msdMessageCenterPriorityWarning
EndIf
Regards, Jon Summers
LA Solutions
Jon,
Could I apply your code to my code? Because my config file is found in my local C: drive.
I don't understand how IsConfigurationVariableDefined (CfgVarName) read my config file(notepad).
Ahmet, it's not clear from your post, when your code is executed. If your ma is automatically loaded with microstation, you must asure that the user interface is loaded before calling such keyins.
Normally this would be done in a callback to
mdlSystem_setFunction (SYSTEM_NEW_DESIGN_FILE, yourcallback);
inside the callback test for SYSTEM_NEWFILE_COMPLETE to asure complete loading of the dgn file, which should result in an even fully loaded UI.
Closing and opening a tasktoolbox might result in some flickering, but I fear you have to live with this. ;-)
I use such a callback for introducing my own menu structure into MicroStation's main menu.
HTH Michael
Edit: sry missed some information from above (MS_DGNAPPS), nevertheless, this works for me (like Jon's example)
RJ:
My config file is found in my local C: drive
You've placed your config.file in a location other than the standard locations?
There's no VBA method to open and read a config. file. Better solutions might be...
If those aren't satisfactory suggestions, then you could use this MDL function...
Declare Function mdlSystem_processCfgVarFile Lib "stdmdlbltin.dll" ( _
ByVal fileName As String , _
ByVal startingProcessLevel As Long ) As Long
In addition to Jon's MicroStation workspace recommendations as one good storage medium, depending on your needs and requirements there are some other common areas that applications can scribble their data possibly worth considering too.
1. Store settings using Microsoft VBA's VBA.Interaction methods:
DeleteSetting, GetAllSettings, GetSetting, and SaveSetting
2. Store settings in a Microsoft Initialization (.ini) file
Accessing Windows Initialization Files from Visual Basic
3. Store settings in a Microsoft database or supported ODBC flatfile (.xml, .csv, ...)
Using ADO with Microsoft Visual Basic
[V8 VBA] Connection between VBA macro and Access Database
A number of application developers prefer to store their preferences in .xml format since the format implies a certain structure to the data (schema) in an open format. Lastly it is always good idea to consider exploring some of the lower-level programming methods available in the programming environment since more advanced developers may use those more frequently to read and write specific data types at certain locations using either text or binary data. One area to start that would be: VBA's - Open, Seek, Put, and Get, Microsoft's Scripting Object - Scripting.File TextStream methods.
HTH,
Bob
Through help of individuals here and copying similar code from other posts I have the following code to locate a named group, aquire vertices and use these vertices to place a fence. Originally I used keyins for placing the fence and replaced with Fence.DefineFromModelPoints. However I get run time error 424 "Object Required" when using Fence.DefineFromModelPoints . It does ocassionally work but is random. The msgbox commands verify I am getting accurate points for placement. Can anyone advise what I need to add to correct the problem?
Thanks to anyone who can advise.
Sub ProcessModel(ByVal oModel As ModelReference)
Dim ndgStartGroup As NamedGroupElement
Dim NamedGroupContents() As NamedGroupMember
Dim eleStartElement As ShapeElement
Dim p3dStartPoint() As Point3d
Dim oFence As Fence
Dim i As Integer
Dim J As Integer
Dim oview As View
' Routine reviews attachments for group name "plot"
If NamedGroupExists("plot", oModel, ndgStartGroup) Then
NamedGroupContents = ndgStartGroup.GetMembers
For J = LBound(NamedGroupContents) To UBound(NamedGroupContents)
Set eleStartElement = NamedGroupContents(J).GetElement
Debug.Print "Element #" & J
If eleStartElement.IsShapeElement Then
ReDim p3dStartPoint(1 To eleStartElement.AsShapeElement.VerticesCount)
For i = 1 To eleStartElement.AsShapeElement.VerticesCount
p3dStartPoint(i) = eleStartElement.Vertex(i)
Next
Set oview = ActiveDesignFile.Views(1)
MsgBox p3dStartPoint(2).X
MsgBox p3dStartPoint(2).Y
MsgBox p3dStartPoint(4).X
MsgBox p3dStartPoint(4).Y
'oview Redraw
'CadInputQueue.SendKeyin "VIEW ON 1"
Fence.DefineFromModelPoints
'CadInputQueue.SendKeyin "place fence block"
'CadInputQueue.SendKeyin "PLACE FENCE ICON "
'CadInputQueue.SendDataPoint p3dStartPoint(2)
'CadInputQueue.SendDataPoint p3dStartPoint(4)
End If
Next
End If
End Sub
Try creating your fence from model points by passing information to the DefineFromModelPoints method. In the VBA editor there is convenient help for almost every method you may need to use by knowing and using some of the following keys: F2 - Open the Microsoft VBA object browser to search for an item of interest. Hilight that item in the browser (or in your VBA code with the cursor on the word) and press F1 (VBA help for the item the cursor is on). With the help file open to the topic, make sure that all the parameters (required informational items) are provided in the documented format. Lastly look at the top of the help topic to see if the "Example" link is hyperlinked (unfortunately not for this specific method though) and copy and try the sample code provided in the help.
Your problem is that you are not providing an object where the fence is ready and available. In most cases you can use the ActiveDesignFile.Fence object. I would suggest taking a look at the MicroStation VBA help by searching in the Search tab for the help topic: "Add the Contents of a Fence to a Named Group". This sample code performs some similar items that you are looking to perform.
If your code needs to get of of the code if no fence is defined when needed, you could always do something similar to this:
' Need a fence
If Not ActiveDesignFile.Fence.IsDefined Then
Exit Sub
End If
HTH,
Bob
Michael Stark:
Ahmet, it's not clear from your post, when your code is executed. If your ma is automatically loaded with microstation, you must asure that the user interface is loaded before calling such keyins.
Normally this would be done in a callback to
mdlSystem_setFunction (SYSTEM_NEW_DESIGN_FILE, yourcallback);
inside the callback test for SYSTEM_NEWFILE_COMPLETE to asure complete loading of the dgn file, which should result in an even fully loaded UI.
Closing and opening a tasktoolbox might result in some flickering, but I fear you have to live with this. ;-)
I use such a callback for introducing my own menu structure into MicroStation's main menu.
HTH Michael
Edit: sry missed some information from above (MS_DGNAPPS), nevertheless, this works for me (like Jon's example)
Hi Michael,
Thank you.
I also tried Jon's and your suggestion to open task toolbox dialog on SYSTEM_NEWFILE_COMPLETE callback.
I think, my problem is different now. Sometimes tasktoolbox key-ins are not available and mostly if task toolbox dialog is closed.
By the way, when I tried below function my custom toolbox icons became visible but still sometimes tasktoolbox key-ins is not working.
mdlInput_sendKeyinFrom ("tasktoolbox close;tasktoolbox open \\AK SS3K", 0, INPUTQ_EOQ, NULL, FROM_KEYBOARD);
I will give char * taskIdP to mdlInput_sendKeyin functions to make sure exeuction of key-ins but I have no idea about how to find task ID of tasktoolbox commands.
Regards,
Ahmet Sedat ALIS
TASKTOOLBOX should be the TaskId for the TASKTOOLBOX keyins - if required. mdlInput_sendSynchronizedKeyin() is the preferred way to drive via keyins for MicroStation V8.5 2004 Edition and later. You may want to use the mdlInput_setFunction (INPUT_ENTER_IDLE, HandleEnterIdle) event since it is fired slightly later than SYSTEM_NEWFILE_COMPLETE, as mentioned and recommended in this previous thread. Try each of those changes one at at time to verify which one may resolve the issue.
Bob
[quote user="Robert Hook [Bentley]"]
TASKTOOLBOX should be the TaskId for the TASKTOOLBOX keyins - if required. mdlInput_sendSynchronizedKeyin() is the preferred way to drive via keyins for MicroStation V8.5 2004 Edition and later. You may want to use the mdlInput_setFunction (INPUT_ENTER_IDLE, HandleEnterIdle) event since it is fired slightly later than SYSTEM_NEWFILE_COMPLETE, as mentioned and recommended in this previous thread. Try each of those changes one at at time to verify which one may resolve the issue.
// used these lines by queuing CMD_AKLOAD_ALL command inside main()
mdlInput_sendSynchronizedKeyin ("dialog tasknavigation on",0, INPUTQ_EOQ, NULL);
mdlInput_sendSynchronizedKeyin ("tasktoolbox close;tasktoolbox open \\AK SS3K",0, INPUTQ_EOQ, NULL);
// Load all command is queued like this;
mdlInput_sendCommand(CMD_AKLOAD_ALL,"",INPUTQ_EOQ,mdlSystem_getCurrTaskID(),DATABASE);
I didn't prefer SYSTEM_NEWFILE_COMPLETE because when you first open task toolbox,
you don't need to update it on every new design file is opened. Just display it on startup.
I tried to use the debugger in VS2005 to solve a problem, After compiling in "debug" mode and starting MicroStation, as soon as my tool was called, MicroStation crashed. I determined the issue was related to a call to ElementAgend.SetCapacity(). I temporarily removed the statement and was able to use the debugger to find my issue, but I was wondering why this call apparently when used in a "release" compile doesn't have the same issue.
class MyClass : public MstnElementSetTool
{
private:
ElementAgenda m_elementAgenda;
public:
MyClass( UInt32 cmdNumber, UInt32 cmdName
{
m_elementAgenda.SetCapacity(2);
}
};
Thanks,
Bruce