How to load several files in a CadViewerControl
Moderators: SDS, support, admin
How to load several files in a CadViewerControl
I'm beginner with Cad.net and I need to open several files (DXF or DWG) and display them together in a single control.
How can I do that ?
I'm programming using VB.Net
How can I do that ?
I'm programming using VB.Net
Re: How to load several files in a CadViewerControl
Hello,
Single CADViewerControl instance cannot load and display several DWG/DXF files at once.
Mikhail
Single CADViewerControl instance cannot load and display several DWG/DXF files at once.
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: How to load several files in a CadViewerControl
Thank you for your answer.
I tried with a CadViewerControl to load 2 differents files using this way :
And with a second button :
With second button, is the file inserted as a block ?
Or is it possible in a ViewerControl to open several files only as block ?
I tried with a CadViewerControl to load 2 differents files using this way :
Code: Select all
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Img = New CADImage
Img = CADImage.CreateImageByExtension("2carres.dwg")
Img.LoadFromFile("2carres.dwg")
CadViewerControl1.LoadFile("2carres.dwg")
End Sub
Code: Select all
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim DP1 As New DPoint(0, 0, 0)
Dim DPScale As New DPoint(1, 1, 1)
Img = New CADImage
Img = CADImage.CreateImageByExtension("2cercles.dwg")
Img.LoadFromFile("2cercles.dwg")
CadViewerControl1.Image.AddScaledDXF(Img, "2cercles.dwg", DP1, DPScale, 0)
End Sub
Or is it possible in a ViewerControl to open several files only as block ?
Re: How to load several files in a CadViewerControl
CADImage.AddScaledDXF method inserts an Xref - a reference to an external DWG/DXF file that appears in the current drawing and gives you the visual impression that it is part of the drawing.
Xrefs are often compared to blocks, but they have a major advantage over the latter. When a block is inserted into a project, its geometry does not change regardless of the source file’s changes. When an Xref is inserted to a project, the host project is updated at every opening with what the current state of the Xref is.
Mikhail
Xrefs are often compared to blocks, but they have a major advantage over the latter. When a block is inserted into a project, its geometry does not change regardless of the source file’s changes. When an Xref is inserted to a project, the host project is updated at every opening with what the current state of the Xref is.
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: How to load several files in a CadViewerControl
Thank you for the explanation, but for the moment Xref is exactly what I need. I just need to display some files, user will not be allowed to modify them.
There is something I don't understand. I you refer to my previous post, I've 2 buttons, if I click on button 1 then button 2, no problem (load a file then display another file as Xref). But if I click directly on button 2, so without loading another file before, I've an error and cannot display the file as Xref.
There is something I don't understand. I you refer to my previous post, I've 2 buttons, if I click on button 1 then button 2, no problem (load a file then display another file as Xref). But if I click directly on button 2, so without loading another file before, I've an error and cannot display the file as Xref.
Re: How to load several files in a CadViewerControl
Hi
The problem with button 2 occurs because to display a file as Xref you need to create a CADImage first like follows:
Without cadViewerControl1.Image = ImgBase you'll get an exception at CadViewerControl1.Image.AddScaledDXF(Img, "2cercles.dwg", DP1, DPScale, 0)
Andrei
The problem with button 2 occurs because to display a file as Xref you need to create a CADImage first like follows:
Code: Select all
ImgBase = New CADImage
ImgBase.InitialNewImage()
cadViewerControl1.Image = ImgBase
Andrei
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support