Showing results 1 to 3 of 3

Thread: Import Solidworks 3D

  1. #1
    Join Date
    02.04.2015
    Posts
    2

    Default Import Solidworks 3D

    Hi All, can anyone tell me how to import a solidworks 3d drawing into zenon so that i can zoom and rotate etc using multi touch

  2. #2
    Join Date
    13.08.2013
    Posts
    57

    Default Re: Import Solidworks 3D

    Hi,
    I try to cover your question here in short and will write a blog following in more detail.
    Currently we are using WPF with HelixToolkit.WPF or HelixToolkit.SharpDX to integrate 3D Files in zenon, please check https://github.com/helix-toolkit/hel.../master/Source , also there are some nice examples, some of the code underneath comes from these examples so check them out.
    The difference between HelixToolkit.WPF and HT.SharpDX is that .WPF will use the WPF 3d integration for drawing whereas .SharpDX will use DirectX. To summarize .WPF will be easier to work with and .SharpDX will enhanced performance (if you have 20MB+ 3D Files) and some neat effects.


    Ok now some preperation, Helix works best with .3ds and .obj but also offers other parsers (Solidworks could work but I'm not sure). There are tons of converters online and offline which could translate your file e.g. https://www.babel3d.com/ , http://www.greentoken.de/onlineconv/ , https://www.blender.org/
    Now we should have a file to work with lets get started with the WPF. Using Visual Studio create a new WPF UserControl Library and add HelixTool.WPF.dll Library as Reference. Then declare the namespace in the Xaml as e.g. xmlns:helix="http://helix-toolkit.org/wpf"
    One Control of Helix we will use will be HelixViewport so we add it to our XAML (I linked a sample so you can check it out).
    Also the HelixViewport offers Zoom,Rotate etc. via Mouse,Keyboard,Touch by Default.
    Now we need some ModelVisual to load our 3D model to. Now the Xaml Code should look something like this.
    
        
        
          
          
        
                
        
    

    Now we need to Load the 3D File, in this case well do it in the LoadedEvent of the control.
    private void UserControl1_Loaded(object sender, RoutedEventArgs e)
        {
         
          this.FileOpen();   //we open the File on Load
        }
         private async void FileOpen()
        {
    
    
          try {
            string filePath = @"C:\ProgramData\COPA-DATA\SQL2012\5906c4cc-439e-47a6-bed8-36820638560e\FILES\zenon\custom\additional\MyFile.3ds";   //we use a static path, feel free to change it
            Model3DGroup group = await this.LoadAsync(filePath, false);     //we load async to avoid freezing
            this.modelVisual.Content = group;    //we attach our loaded 3d to our modelVisual as content
            this.viewport.ZoomExtents(0);
          }
          catch
          {
    
          }
          //Extent the zoom of the viewport, to fully see our 3dContent
    
        }
        private async Task LoadAsync(string model3DPath, bool freeze)
        {
          return await Task.Factory.StartNew(() =>
          {
            var mi = new ModelImporter();        //HelixToolkit comes with a nice interface to Import and Export
    
            if (freeze)
            {
              // Alt 1. - freeze the model 
              return mi.Load(model3DPath, null, true);
            }
    
            // Alt. 2 - create the model on the UI dispatcher
            return mi.Load(model3DPath, this.Dispatcher);
          });
        }
    Now we have the most basic components to see our 3D File. We only add a Wrapper Xaml to use it in zenon something like this.

    
        
          
                
        
    


    Please find attached the sample VS-Project and a sample zenon-Project (720,Build 23002)

    Best regards
    Sigi
    Attached Files Attached Files
    Last edited by sntech : 10th November 2015 at 09:20

  3. #3
    Join Date
    02.04.2015
    Posts
    2

    Default Re: Import Solidworks 3D

    Thank you very much for this, i have had success using this method. What if we wanted to take this a step further and animate the 3D, so that we can show the actual axis positions of a robot arm for example.

Similar Threads

  1. XML Import - Variables
    By abcd1234 in forum zenon Supervisor
    Replies: 2
    Last Post: 23rd December 2013, 17:00
  2. s7 project import
    By gh_ounie in forum Drivers
    Replies: 1
    Last Post: 27th October 2008, 12:59
  3. Import Variables
    By dak2483 in forum zenon Supervisor
    Replies: 2
    Last Post: 4th August 2008, 12:33
  4. Replies: 0
    Last Post: 20th August 2007, 14:00

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •