hi,
Please help me on the below subject.
VBA not recording the Text Height, Text Width.
for reference, please find the attachement
Sub Macro3() Dim startPoint As Point3d Dim point As Point3d, point2 As Point3d Dim lngTemp As Long' Start a command CadInputQueue.SendCommand "MODIFY TEXT" CommandState.StartDefaultCommandEnd Sub
Regards,
Shahad
Hi Shahad,
it's not ensured VBA recorder is able to record everything. Sometimes it's because of a step is modal (MicroStation stops and wait until e.g. a dialog is closed), or (which seems to be this case) the tool does not publish own internals, so the recorder is not able to obtain the values.
Can you provide more information what do you want to achieve and how you want to use the recorded code? In my opinion, when working with existing MicroStation tools and don't creating own ones, it's better to use "set item toolsettings" key-in to set values in Tool parameters dialog.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thank you for your reply,
I have typical drawings around 1800. in my previous version J7 I did the same. Actually I need to change text size in every drawing
Eg: in J7
I use the below code
Sub main
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint
' Set a variable associated with a dialog box
MbeSetAppVariable "MODIFY", "tcb->actfont", 61&
' Start a command
MbeSendCommand "ACTIVE FONT 61"
MbeSetScaledAppVar "MODIFY", "tcb->chheight", 0.003#
MbeSetScaledAppVar "MODIFY", "tcb->chwidth", 0.003#
MbeSetScaledAppVar "MODIFY", "tcb->nodespace", 0.002#
End Sub
But here in V8 (SS2)
The same code not working.
Please see the image.
Also we are using add on tool named AUTO SACS (please find the image) in J7 I was using some macros for renaming the text for that. I have 20000 drawings need to change the date and some other details. in my previous version J7 I use the macro for the same please see the below code.
Also we are using add on tool named AUTO SACS (please find the image) in J7 I was using some macros for renaming the text for that. I have 20000 drawings need to change the date and some other details. in my previous version J7 I use the macro for the same please see the below code.' TITLE BLOCK LATSub main Dim startPoint As MbePoint Dim point As MbePoint, point2 As MbePoint' Set a variable associated with a dialog box MbeSetAppVariable "TBA", "gs.s_drawing_no", "851636" MbeSetAppVariable "TBA", "gs.s_index", "J" MbeSetAppVariable "TBA", "gs.s_type", "LOG" MbeSetAppVariable "TBA", "gs.s_rev", "01" MbeSetAppVariable "TBA", "gs.date", "11/01/12" MbeSetAppVariable "TBA", "gs.revisionDesc", "AS BUILT" MbeSetAppVariable "TBA", "gs.s_border", "defa05.bor" MbeSetAppVariable "TBA", "gs.s_general_desc", "WOSEP UNIT SHUTDOWN" MbeSetAppVariable "TBA", "gs.dccNumber", "10-00450-0002-258" MbeSetAppVariable "TBA", "gs.s_plant_no", "Q36" MbeSetAppVariable "TBA", "gs.s_plant_desc", "WATER OIL SEPARATION PLANT (2/12)" MbeSetAppVariable "TBA", "gs.da_cert", "HSU" MbeSetAppVariable "TBA", "gs.da_eng_date", "06/08/10" MbeSetAppVariable "TBA", "gs.rfkd_const", "DSS" MbeSetAppVariable "TBA", "gs.rfkd_const_date", "06/08/10" MbeSetAppVariable "TBA", "gs.da_cert_date", "06/08/10" MbeSetAppVariable "TBA", "gs.rfkd_op_date", "06/08/10"End Sub
Hi Shadad,
did you read my notice about "set item toolsettings" key-in? This is standard tool simplifying usage of MicroStation tool in batch mode or when customized tool is created. VBA is typically not required, only in some special situations or as general manager.
Instead of tricky direct tcb values changing, the code can be easily replaced by set of key-ins similar to
modify text;set item toolsettings changetextheighttoggle=1;set item toolsettings changetextheight=0.123;set item toolsettings changetextwidthtoggle=1;set item toolsettings changetextwidth=1.987
This key-in has been discussed many times, it's also described in wiki article.
Unknown said:in my previous version J7
Please clarify what you mean by 'version J7'. Do you mean MicroStation/J or something else?
Regards, Jon Summers LA Solutions
Unknown said:The same code not working
You can translate that BASIC code to VBA almost literally...
Sub TitleBlockLat () SetCExpressionValue "gs.s_drawing_no", "851636", "TBA" SetCExpressionValue "gs.s_index", "J", "TBA" SetCExpressionValue "gs.s_type", "LOG", "TBA" SetCExpressionValue "gs.s_rev", "01", "TBA" SetCExpressionValue "gs.date", "11/01/12", "TBA" SetCExpressionValue "gs.revisionDesc", "AS BUILT", "TBA" SetCExpressionValue "gs.s_border", "defa05.bor", "TBA" SetCExpressionValue "gs.s_general_desc", "WOSEP UNIT SHUTDOWN", "TBA" SetCExpressionValue "gs.dccNumber", "10-00450-0002-258", "TBA" SetCExpressionValue "gs.s_plant_no", "Q36", "TBA" SetCExpressionValue "gs.s_plant_desc", "WATER OIL SEPARATION PLANT (2/12)", "TBA" SetCExpressionValue "gs.da_cert", "HSU", "TBA" SetCExpressionValue "gs.da_eng_date", "06/08/10", "TBA" SetCExpressionValue "gs.rfkd_const", "DSS", "TBA" SetCExpressionValue "gs.rfkd_const_date", "06/08/10", "TBA" SetCExpressionValue "gs.da_cert_date", "06/08/10", "TBA" SetCExpressionValue "gs.rfkd_op_date", "06/08/10", "TBA" End Sub
Where TBA is the name of the application, and gs is that app's variable name. If that isn't working in MicroStation V8 but was working in a previous version then perhaps either
TBA
gs
You can find out which, simply by recording a VBA macro while that huge dialog is active. Make a change, then stop recording the macro and examine the source code.
yes...i mean Microstation/J
I recorded the same way; the result (code) is below mention
Sub Macro16() Dim startPoint As Point3d Dim point As Point3d, point2 As Point3d Dim lngTemp As Long' Send a keyin that can be a command string CadInputQueue.SendKeyin "vba load aramco_sacs;vba execute [aramco_sacs] call Sacs.TBAShow" CommandState.StartDefaultCommandEnd Sub
it is not showing all code
eg: i rename
Rev. No,
Date,
Revision Description,
Eng,
Cert. by
Date.
but in Microstation/J it can.
Thank you very much
Unknown said:it is not showing all code
as I wrote already, it's responsibility (or bug) of the tool or application what parameters will be shared outside. When the application hides the parameters, VBA macro recorder access them.
Unknown said:vba load aramco_sacs
aramco_sacs is a VBA project. That is, you should be able to see aramco_sacs.mvba in your VBA projects folder.
aramco_sacs
aramco_sacs.mvba
Unknown said:vba execute [aramco_sacs] call Sacs.TBAShow
That instructs aramco_sacs to execute a subroutine Sacs.TBAShow. From its name, I guess that's what opens the huge dialog.
Sacs.TBAShow
Unknown said: it is not showing all code ... but in Microstation/J it can
it is not showing all code ... but in Microstation/J it can
I'm guessing that the equivalent application for MicroStation/J was written in MDL, and your BASIC macro was able to modify its published variables. It looks like the V8 aramco_sacs is all VBA, and consequently doesn't publish any variable for you to capture.
Is the aramco_sacs VBA project password-protected? If not, you can modify the VBA code to do what you want. If it is password-protected, you'll have to talk to the authors to find what's possible.