how to change text into same direction in one process..??. i have so many text.. and if i have to change one by one... it takes time.... thanks
Select elements and change angle in Element properties window. Unfortunately there is no command to for example rotate all cells/text to 0 degree so it is horizontal and either need macro or use element properties.
communities.bentley.com/.../rotate-text-placed-at-arbitrary-angle-back-to-0-or-90-degree
Oto said:Unfortunately there is no command to for example rotate all cells/text to 0
Doesn't the Active Angle Assistant mentioned by Judy Wong provide that function?
Regards, Jon Summers LA Solutions
It is VBA macro and VBA is hard to set up for non advanced users especially in CONNECT edition. For example it is hard to explain that in CE you have to load the Macro and then go to macro tab and only there you can run it. It was easier in v8i but even then most still used MSBASIC which was straightforward without confusing projects, modules, procedures.
Answer Verified By: cahyadi idayhac
Hi Oto, did you find a solution to your question?
Oto said:For example it is hard to explain that in CE you have to load the Macro and then go to macro tab and only there you can run it.
Usually, all that's need to run a VBA macro is key-in vba run [projectName]moduleName.procedureName.
vba run [projectName]moduleName.procedureName
Oto said:It was easier in v8i
The same key-in works in all versions of MicroStation that provide VBA.
Oto said:in v8i but even then most still used MSBASIC which was straightforward
I think that plenty of people moved to VBA. There are good reasons to prefer VBA to BASIC.
Jon Summers said:The same key-in works in all versions of MicroStation that provide VBA
Not really it started to work only in U4 (Defect # 490208)
Still there are lots of glitches if trying to run it from utilities menu. Key-in syntax also is not easy you have to know VBA internals. Also not clear why option to run macro from VBA project list was removed. Complicated.
VBA is a last choice for quick tools, too dependent on external uncertainties. Doesn't feel integrated in product at all. Wish BMR macros were more useful.
yaxo winx said:Hi Oto, did you find a solution to your question?
There is no solution except manually iterate using properties window.But hey you can vote and it maybe will be included in U30 in year 2025 - https://microstation.ideas.aha.io/ideas/MS-I-307
Oto said:But hey you can vote and it maybe will be included in U30 in year 2025
Unfortunately or fortunately for me, I don't plan to switch from v8i to CONNECT
You are fortunate as is it is easy in MSBASIC and v8i is still supported. Copy it to txt, rename to bas and you are good to go.
This script rotates selected element or elements to zero degrees.
'Rotate to zero 'Selection set or element Function alfa#(sine#,cosine#) If cosine = 0.0 Then If sine > 0.0 Then angle# = 90.0 Else angle = 270.0 End If Else angle = Atn(sine / cosine) * 180.0# / PI If cosine < 0.0 Then angle = angle + 180.0 ElseIf sine < 0.0 Then angle = angle + 360.0 End If End If alfa = angle End Function Sub main Dim point As MbePoint,origin As MbePoint Dim elemSet as New MbeElementSet Dim setMember as MbeSetMember Dim element as new MbeElement Dim rotation(2, 2) as Double MbeSendCommand "ACTIVE ANGLE 0°" If elemSet.fromSelectionSet (1) <> MBE_Success Then If elemSet.fromFence() <> MBE_Success Then MbeWriteStatus "No fence or selection set" Else MbeWriteStatus "Processing Fence" End If Else MbeWriteStatus "Processing Selection Set" End If MbeSendCommand "MARK" status = elemSet.getFirst(setMember) Do While status = MBE_Success filePos& = element.fromFile(setMember.filePos, setMember.fileNum) If element.isGraphics <> 0 Then ' If element.type = MBE_Text Then If element.getRotation(rotation) = MBE_Success Then lenkis#=(360-alfa(rotation(1,0),rotation(0,0)))*PI/180 If element.getOrigin(origin) = MBE_Success Then If element.rotate(lenkis,0,0,origin) = MBE_Success Then stat=element.rewrite() End If ' End If End If End If End If status = elemSet.getNext (setMember) Loop elemSet.clear MbeSendCommand "PLACE FENCE ICON " Do MbeStartLocate MbeWritePrompt "Choose element" MbeGetInput MBE_DataPointInput, MBE_ResetInput If MbeState.inputType = MBE_DataPointInput Then stat = MbeState.getInputDataPoint(point) MbeSendLastInput filePos&=element.fromLocate() If filePos>=0 Then If element.getRotation(rotation) = MBE_Success Then lenkis#=(360-alfa(rotation(1,0),rotation(0,0)))*PI/180 If element.getOrigin(origin) = MBE_Success Then If element.rotate(lenkis,0,0,origin) = MBE_Success Then stat=element.rewrite() End If End If End If End If Else MbeSendReset MbeStartDefaultCommand End End If Loop End Sub
Original author left so not sure if thread was about CONNECT or v8i version
Oto said:You are fortunate as is it is easy in MSBASIC and v8i is still supported. Copy it to txt, rename to bas and you are good to go. This script rotates selected element or elements to zero degrees
This script rotates selected element or elements to zero degrees
Oto, Thank you for your feedback
Fortunately with some help of my friend programmer, I could achieve this need with the use of VBA code.
You just need to change/enter angle value and level name(s) in the code and vualia.
---
Angle = Radians(ENTER.YOUR.ANGLE.VALUE)
oScanCriteria.IncludeLevel ActiveDesignFile.Levels("ENTER.YOUR.LEVEL.NAME1")
Sub RotateElementAboutZ(ele As Element, pntFixed As Point3d, dblRadians As Double) Dim RotationMatrix As Matrix3d Dim Eltrans As Transform3d Dim Axis As Point3d Axis.X = 0 Axis.Y = 0 Axis.Z = 1 RotationMatrix = Matrix3dFromVectorAndRotationAngle(Axis, dblRadians) Eltrans = Transform3dFromMatrix3dAndFixedPoint3d(RotationMatrix, pntFixed) ele.Transform Eltrans End Sub Sub RotateText() Dim xRot As Double, yRot As Double, zRot As Double, uniformScale As Double Dim Angle As Double Angle = Radians(ENTER.YOUR.ANGLE.VALUE) Dim oScanCriteria As ElementScanCriteria Set oScanCriteria = New ElementScanCriteria oScanCriteria.ExcludeAllLevels oScanCriteria.IncludeLevel ActiveDesignFile.Levels("ENTER.YOUR.LEVEL.NAME1") oScanCriteria.IncludeLevel ActiveDesignFile.Levels("ENTER.YOUR.LEVEL.NAME2") Dim oElEnum As ElementEnumerator Set oElEnum = ActiveModelReference.Scan(oScanCriteria) While oElEnum.MoveNext If oElEnum.Current.Type = msdElementTypeText Then With oElEnum.Current.AsTextElement Matrix3dIsXRotationYRotationZRotationScale .Rotation, xRot, yRot, zRot, uniformScale .Redraw msdDrawingModeErase RotateElementAboutZ oElEnum.Current, .Origin, -zRot RotateElementAboutZ oElEnum.Current, .Origin, Angle .Rewrite .Redraw End With End If Wend End Sub