Hi, I'm using this forum a lot to answers my doubts with old posts (thank you a lot), however I don't found nothing about it.
I'm creating a macro to create a new .dgn file using Fence File (part of drawing that I need). For do it manually is working good. However, than I need use as automation, after call command "FENCE FILE", a windows "Save Fence Contents As" is showing, but the folder and name does not fill automatically by Macro, and if I add a name manually, and press SAVE, window close and files does not save.
Any one knows about that? and How to create a work around to solve this issue?
I'm using the follow script.
Function ExportSheets() Dim modalHandler As New BmrCGMModalHandler AddModalDialogEventsHandler modalHandler CadInputQueue.SendKeyin "FENCE FILE" RemoveModalDialogEventsHandler modalHandler End Function
With Class created as bellow
Implements IModalDialogEvents Private Sub IModalDialogEvents_OnDialogClosed(ByVal DialogBoxName As String, ByVal DialogResult As MsdDialogBoxResult) End Sub Private Sub IModalDialogEvents_OnDialogOpened(ByVal DialogBoxName As String, DialogResult As MsdDialogBoxResult) Dim NewPoint As Point3d CgmDir = ActiveDesignFile.Path + "\" NewPoint.X = ExportNewForm.IDLocationX.Caption + ExportNewForm.NewSheetLocationX.Caption NewPoint.Y = ExportNewForm.IDLocationY.Caption + ExportNewForm.NewSheetLocationY.Caption Dim esc As ElementScanCriteria Set esc = New ElementScanCriteria esc.ExcludeAllTypes esc.IncludeType msdElementTypeText Dim ee As ElementEnumerator Set ee = ActiveModelReference.Scan(esc) Do While ee.MoveNext If ee.Current.AsTextElement.Origin.X > (NewPoint.X - 10) And ee.Current.AsTextElement.Origin.X < (NewPoint.X + 10) Then fileName = ee.Current.AsTextElement.Text End If Loop If DialogBoxName = "Save Fence Contents As" Then CadInputQueue.SendKeyin "MDL COMMAND MGDSHOOK,fileList_setDirectoryCmd " & CgmDir CadInputQueue.SendKeyin "MDL COMMAND MGDSHOOK,fileList_setFileNameCmd " & fileName & ".cgm" ' Remove the following line to let the user close the dialog box. DialogResult = msdDialogBoxResultOK End If ' Save Fence Contents As End Sub
I'm using Microstation Connect Edition Release 13
Thank you.Naime Andere
There any way to save This new file on point (0,0)? Now they are exporting to current position of source file, I need it on point (0,0)
HI Naime,
Naime Andere said:There any way to save This new file on point
Please respect this forum best practices! New question = new post.
Naime Andere said:Now they are exporting to current position of source file
It's how File fence tool is designed: It's a copy of existing file including coordinates.
Naime Andere said:I need it on point (0,0)
In such case you have to implement:
With regards,
Jan
BTW I realized you use Developers and Programming forum. Because your question is about MicroStation, I recommend to move your post to MicroStation Programming forum. To move existing post, use More > Move tool under your original post.
Also, please read the best practices, the are e.g. rules how subject should be formatted to make sharing of important information simpler.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point