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
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
Oto said:It was easier in v8i
yaxo winx said:I don't plan to switch from v8i
Well, it turns out that this thread is about MicroStation V8i.
It's possible that some answers here are irrelevant, since the responders — in the absence of information to the contrary — assume that you yaxo winx are using the current version of MicroStation.
Regards, Jon Summers LA Solutions
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