<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EDA Blog</title>
	<atom:link href="http://edainc.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://edainc.net/blog</link>
	<description>Information about Solid Edge, Solid Works and AutoCAD automation</description>
	<lastBuildDate>Wed, 02 May 2012 17:24:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Meet us at Solid Edge University 2012: Learn about Design Automation for SE</title>
		<link>http://edainc.net/blog/?p=151</link>
		<comments>http://edainc.net/blog/?p=151#comments</comments>
		<pubDate>Mon, 30 Apr 2012 16:16:50 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Solid Edge]]></category>
		<category><![CDATA[Solid Edge University 2012]]></category>

		<guid isPermaLink="false">http://edainc.net/blog/?p=151</guid>
		<description><![CDATA[For the first time ever, EDA, Inc. will be at the Solid Edge conference, Solid Edge University 2012  in Nashville, Tennessee held June 11th to 13th.  We will be demonstrating a Web-based Solid Edge automation program at our sponsor table, as well as having a significant presence at the much anticipated June 11th Solid Edge Developer Day. [...]]]></description>
			<content:encoded><![CDATA[<p>For the first time ever, EDA, Inc. will be at the Solid Edge conference, <a title="Solid Edge University 2012" href="http://www.solidedgeu.com/" target="_blank">Solid Edge University 2012</a>  in Nashville, Tennessee held June 11th to 13th.  We will be demonstrating a Web-based Solid Edge automation program at our sponsor table, as well as having a significant presence at the much anticipated June 11th Solid Edge Developer Day.</p>
<p>At <a title="Developer Day" href="http://www.solidedgeu.com/29" target="_blank">Developer Day</a>, EDA Software Engineer Madison Miner will be presenting the advantages of web-based automation programs as well as discussing best practices when automating Solid Edge on the web. Fellow presenters at Developer Day will include Greg Chasteen (Technical Account Manager, Siemens PLM Software) and Jason Newell (founder of the Solid Edge programming resource site <a title="Jason Newell SE programmer forum" href="http://jasonnewell.net/" target="_blank">JasonNewell.net</a>).  Anyone interested in Solid Edge programming should definitely attend Developer Day.  Topics listed on Siemens’s website include:</p>
<ul>
<li>An overview of the Solid Edge API</li>
<li>Automating Solid Edge</li>
<li>Using Microsoft .NET</li>
<li>Creating Addins and Apps.</li>
<li>An update on the latest development tools for Solid Edge ST5</li>
<li>Round Table discussion with the actual Solid Edge developers.</li>
<li>And More!!</li>
</ul>
<div>
<div id="attachment_155" class="wp-caption alignnone" style="width: 600px"><a href="http://edainc.net/blog/wp-content/uploads/2012/04/SEOnTheWeb.png"><div class="swpf-img"><img class=" wp-image-155  " title="SEOnTheWeb" src="http://edainc.net/blog/wp-content/uploads/2012/04/SEOnTheWeb-1024x703.png" alt="Web application for Solid Edge" width="590" height="404" /></div></a><p class="wp-caption-text">Developing Web Applications for Solid Edge</p></div>
</div>
<p>Want to get a sneak peek at the Web-based program we&#8217;ll be bring to SEU?  <a title="EDA Solid Edge Automation Demo Program" href="http://edainc.net/EnclosureDemoSE2.aspx" target="_blank">This demo</a> shows how a manufacturer of custom products (electrical enclosures in this case) could allow their customers or sales staff to design a unique product on the Web, submit it online, and then receive Solid Edge models or drawings to spec via email, all generated in a few minutes by an automated Solid Edge design program developed by EDA.</p>
<p>As a Siemens Solution Partner  for Solid Edge and a <a title="EDA Solid Edge services" href="http://edainc.net/SolidEdge.aspx">Solid Edge Application Developer</a>, EDA staff will be available to meet with Solid Edge users one-on-one at the conference and discuss developing custom Solid Edge applications.  Improve your company&#8217;s Solid Edge productivity by automating the design of your products.  To make an appointment to meet during the conference, please <a title="Contact EDA" href="http://edainc.net/ContactUs.aspx">contact EDA</a> or call 360-398-1319 (US).</p>
<div id="attachment_158" class="wp-caption alignnone" style="width: 589px"><a href="http://edainc.net/blog/wp-content/uploads/2012/04/CustomSEModel1.png"><div class="swpf-img"><img class=" wp-image-158  " title="CustomSEModel" src="http://edainc.net/blog/wp-content/uploads/2012/04/CustomSEModel1.png" alt="Custom designed model" width="579" height="524" /></div></a><p class="wp-caption-text">Custom models created online using EDA automated programs</p></div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://edainc.net/blog/?feed=rss2&#038;p=151</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Searching large Feature Trees using EDA&#8217;s SelectByName SolidWorks Addin</title>
		<link>http://edainc.net/blog/?p=121</link>
		<comments>http://edainc.net/blog/?p=121#comments</comments>
		<pubDate>Thu, 05 Apr 2012 17:45:01 +0000</pubDate>
		<dc:creator>Misa</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Plug-in]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[Feature Manager Filter]]></category>
		<category><![CDATA[Searching Large Assemblies]]></category>
		<category><![CDATA[SolidWorks addin]]></category>
		<category><![CDATA[SolidWorks automation]]></category>
		<category><![CDATA[SolidWorks Feature Tree]]></category>

		<guid isPermaLink="false">http://edainc.net/blog/?p=121</guid>
		<description><![CDATA[Note: One thing about working for a company that offers SolidWorks automation &#38; custom programming is that it can make you a very lazy SolidWorks user. Very lazy. Any time you have to do the same thing 10 times in a row in SolidWorks, you start to think, &#8220;Hmmm, maybe we could write a program [...]]]></description>
			<content:encoded><![CDATA[<p><em>Note: One thing about working for a company that offers SolidWorks automation &amp; custom programming is that it can make you a very lazy SolidWorks user. Very lazy. Any time you have to do the same thing 10 times in a row in SolidWorks, you start to think, &#8220;Hmmm, maybe we could write a program to automate that&#8230;&#8221;</em></p>
<p>There are a couple ways to find and select components or features in the SolidWorks Feature Tree.  Both of these are built into SolidWorks and can be very helpful when the Feature Tree becomes too large or complex to search through manually.  However, these tools also have their limitations&#8211; <strong>which is why I got EDA&#8217;s software engineers to write me a SolidWorks addin to provide the user with a more powerful search and select tool.</strong></p>
<p>In my case, I had to find and select 50 parts from an assembly of 1500+ parts, some of them 8 levels deep so I could change their appearance to match various backgrounds.  This process had to be repeated for each of the 7 backgrounds that I had to work with.   Yikes!</p>
<div id="attachment_126" class="wp-caption alignnone" style="width: 485px"><a href="http://edainc.net/blog/wp-content/uploads/2012/04/Assembly-Statistics1.png"><div class="swpf-img"><img class="size-full wp-image-126" title="Assembly Statistics" src="http://edainc.net/blog/wp-content/uploads/2012/04/Assembly-Statistics1.png" alt="" width="475" height="332" /></div></a><p class="wp-caption-text">1500+ parts, 8 levels deep!</p></div>
<p>The obvious and most basic tool for navigating the SolidWorks Feature Manager is the Go To command.  Just right click  in the Feature Manager and select &#8220;<span style="text-decoration: underline;">G</span>o To&#8230;&#8221; and type in your search critera.  When you click  &#8220;Find Next&#8221;, the next feature or component that fulfills your search criteria in the tree is highlighted.  This is fine if you are just looking for one component or feature, but it doesn&#8217;t help you search for ALL components that satisfy the search criteria, only the next one.  It will also find mates and reference geometry and other non-components, which I wasn&#8217;t interested in.</p>
<div id="attachment_127" class="wp-caption alignnone" style="width: 493px"><a href="http://edainc.net/blog/wp-content/uploads/2012/04/GoTo-FindInFeatureTree.png"><div class="swpf-img"><img class="size-full wp-image-127" title="GoTo-FindInFeatureTree" src="http://edainc.net/blog/wp-content/uploads/2012/04/GoTo-FindInFeatureTree.png" alt="GoTo dialog box" width="483" height="248" /></div></a><p class="wp-caption-text">Go To finds only the next item in tree</p></div>
<p>Another built-in tool is the Feature Manger Filter.  By typing in the search criteria in the filter box, SolidWorks will show only those components/features that satisfy your search criteria.  This is a quick way to cut through a lot of parts or features and find only those items you want.  However, this tool also has its limitations.  It does not show components if they are hidden or suppressed, and it does not select the filtered components, so you still have to manually select the components in the graphics window or the Feature Tree before you can modify their appearance or perform other actions on them.</p>
<div id="attachment_128" class="wp-caption alignnone" style="width: 610px"><a href="http://edainc.net/blog/wp-content/uploads/2012/04/Filter.png"><div class="swpf-img"><img class=" wp-image-128  " title="Filter Feature Tree" src="http://edainc.net/blog/wp-content/uploads/2012/04/Filter.png" alt="Using the Feature Filter" width="600" height="332" /></div></a><p class="wp-caption-text">Filtering components is helpful but the command doesn&#39;t select the filtered parts...</p></div>
<p>The SelectByName addin developed by EDA is simple to use (it has its own menu with only one command, so you can&#8217;t really miss it!).  Type your search criteria into the search box, hit &#8220;OK&#8221; and the program goes through the entire feature tree, level by level, searching for and selecting every part or feature that fulfills the search criteria.  It works even on parts that may be hidden or suppressed.  <strong>In my 1500+ part assembly, it took about 5 seconds to go through every level and select all the parts I was looking for.  </strong>Now changing the appearance of all these parts at once is just a matter clicking on the Edit Appearance icon in the Heads Up Toolbar and adjusting the colors, illumination, etc.  Thanks guys!</p>
<div id="attachment_129" class="wp-caption alignnone" style="width: 592px"><a href="http://edainc.net/blog/wp-content/uploads/2012/04/SelectByName.png"><div class="swpf-img"><img class=" wp-image-129 " title="SelectByName Addin" src="http://edainc.net/blog/wp-content/uploads/2012/04/SelectByName-1024x495.png" alt="EDA's SelectByName Addin for SW" width="582" height="281" /></div></a><p class="wp-caption-text">SelectByName searches all levels and selects all parts that meet the criteria</p></div>
<p><em><a title="Contact EDA" href="http://edainc.net/ContactUs.aspx" target="_blank">Contact EDA</a> if you have a custom SolidWorks programming application or add in you&#8217;d like to develop.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://edainc.net/blog/?feed=rss2&#038;p=121</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating block insertion into the AutoCAD display area</title>
		<link>http://edainc.net/blog/?p=80</link>
		<comments>http://edainc.net/blog/?p=80#comments</comments>
		<pubDate>Thu, 22 Mar 2012 19:21:37 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[AutoCAD]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[AutoCAD Plug-in]]></category>
		<category><![CDATA[AutoLIST Block Insertion]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Display Coordinate System (DCS)]]></category>
		<category><![CDATA[Viewport]]></category>
		<category><![CDATA[World Coordinate System (WCS)]]></category>

		<guid isPermaLink="false">http://edainc.net/blog/?p=80</guid>
		<description><![CDATA[As EDA is in the business of developing custom AutoCAD programs, and that task usually falls upon my shoulders, I found myself in the position of developing an AutoCAD 2012 plug-in that needed the ability to insert a block somewhere within the viewable area of the AutoCAD drawing window. The reason for this was that [...]]]></description>
			<content:encoded><![CDATA[<p>As EDA is in the business of developing custom AutoCAD programs, and that task usually falls upon my shoulders, I found myself in the position of developing an AutoCAD 2012 plug-in that needed the ability to insert a block somewhere within the viewable area of the AutoCAD drawing window. The reason for this was that after the block was inserted I would invoke a move command upon that block so that the user could then choose a location for the block with the ability to see the block as they are moving it into position.<br />
<span id="more-80"></span><br />
In the case of the block I was dealing with, it had a base point in the upper right of the block. Thus ideally I wanted to insert that block at the upper right corner of the viewable drawing area.</p>
<p>To give you a visual reference for my problem, here is the sample block to be inserted:<div class="swpf-img"><img class="alignnone size-full wp-image-97" title="SampleBlock" src="http://edainc.net/blog/wp-content/uploads/2012/03/SampleBlock.png" alt="Sample Block" width="832" height="386" /></div></p>
<p>Here is the sample drawing into which the above block is to be inserted:<div class="swpf-img"><img class="alignnone size-full wp-image-98" title="SampleFloorPlan" src="http://edainc.net/blog/wp-content/uploads/2012/03/SampleFloorPlan.png" alt="Sample Floor Plan" width="828" height="386" /></div></p>
<p>And this is the desired result:<div class="swpf-img"><img class="alignnone size-full wp-image-96" title="InsertionExample" src="http://edainc.net/blog/wp-content/uploads/2012/03/InsertionExample.png" alt="Insertion Example" width="830" height="386" /></div></p>
<p>We must of course keep in mind that the extents of the drawing has no relation to the extents of the current view, unless of course you have just performed a <em>zoom extents</em> upon the drawing. At which point they will appear to be the same.</p>
<p>Fortunately AutoCAD provides a means for retrieving information on the currently active viewport. A viewport as the name implies is view upon the objects of the drawing. The drawing objects themselves are defined within a three dimensional (3D) space, using X, Y, and Z coordinates. The viewport however is two dimensional (2D); it has a width and height with a center point that is directed along a particular direction with a specified twist. In the simplest case you can image peering down the Z axis at objects on the X,Y plane, not unlike looking straight down from <a href="http://twentytwowords.com/2011/02/09/the-view-straight-down-from-the-top-of-the-golden-gate-bridge/" target="_blank">the top of the Golden Gate Bridge</a>.</p>
<p>The direction of this viewport may or may not be pointed at the objects in the drawing. Additionally the twist of the viewport may cause those same objects to appear rotated to the point of being upside down.</p>
<p>So regardless of how the viewport was oriented, I still want the above mentioned block to insert at the upper right of the viewport. Also as I mentioned, AutoCAD provides a means to obtain the viewport information. However this viewport information is not only specified in 2D (X,Y coordinates), but it is also defined in something called the DCS, which stands for the <em>Display Coordinate System</em>. The objects of the drawing are in 3D (X,Y,Z coordinates) and use something called the WCS, meaning the <em>World Coordinate System</em>. Most user input into AutoCAD, including through the API (AutoCAD&#8217;s programming interface), requires that points be specified in WCS; the end points of lines, the center of a circle, and in our particular case, the insertion point of a block.</p>
<p>So while it is not difficult to determine the 2D point of the upper right of the viewport, converting that 2D point in DCS to a 3D point in WCS requires knowing matrix algebra. Something that typically isn&#8217;t taught until second year college mathematics.</p>
<p>But once again, AutoCAD provides a convenient <code>Matrix3d</code> class to help us deal with the problem. But even with this help you still need to know what you&#8217;re doing in order to utilize it. This is where a great web site called <a href="http://through-the-interface.typepad.com/" target="_blank">Through the Interface</a> provided the key to my answer. I can not say enough good things about this site. While I have not been able to solve every problem I&#8217;ve run into I could usually find enough pieces of information to allow me to find the relevant classes or keywords with which to search the enormous ObjectARX documentation.</p>
<p>The key to my answer was found within a post on using Kinect; amongst the listing of the source code lay the nugget I required. A short simple routine that provides a transformation matrix to allow coordinates to be converted based on a viewport, as follows:</p>
<pre style="line-height: 14px;">    public static Matrix3d Wcs2Dcs(AbstractViewTableRecord vtr)
    {
        Matrix3d mat = Matrix3d.PlaneToWorld(vtr.ViewDirection);
        mat = Matrix3d.Displacement(vtr.Target - Point3d.Origin) * mat;
        mat = Matrix3d.Rotation(-vtr.ViewTwist, vtr.ViewDirection, vtr.Target) * mat;
        return mat.Inverse();
    }</pre>
<p>But wait, the sharp-eyed among will say, that routine returns a matrix for converting WCS to DCS when in fact we need to convert in the other direction!</p>
<p>Fortunately both matrix algebra and AutoCAD provide a simple means for doing this, called the inverse of the matrix. While the details of the inverse are not important for us, the results are. If are interested in the details please check out the link to <a href="http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/index.htm" target="_blank">EuclideanSpace.com</a>. It is very good site for those with a mathematical bent.</p>
<p>You will notice that the <code>Wcs2Dcs()</code> routine constructs a matrix by using the 2D DCS information of a <code>ViewTableRecord</code> (this is how AutoCAD stores a viewport). The last line of that routine returns the inverse of that matrix. In matrix algebra, the inverse of the inverse of a matrix is the same as the original matrix. Thus I can solve my problem by just using the inverse of the returned matrix as follows:</p>
<pre style="line-height: 14px;">    Matrix3d dcs2wcs = Wcs2Dcs(view_table_record).Inverse();</pre>
<p>Thus to convert a 2D DCS point to a 3D WCS point would appear as follows:</p>
<pre style="line-height: 14px;">    Point2d  center_dcs = view_table_record.CenterPoint;
    Matrix3d dcs2wcs    = Wcs2Dcs(view_table_record).Inverse();
    Point3d  center_wcs = center_dcs.TransformBy(dcs2wcs);</pre>
<p>Note the convenient <code>.TransformBy()</code> call provided by AutoCAD&#8217;s <code>Point2d</code> class that converts our DCS center point to a WCS point using the inverse of the transformation matrix returned by the <code>Wcs2Dcs()</code> routine.</p>
<p>Below you&#8217;ll find the actual C# source code for a routine called <code>GetActiveViewportExtents()</code>which returns the current viewport&#8217;s extents, i.e., the lower-left-most and upper-right-most points. You will also find sample code that makes use of this routine to insert a block at the upper-right most point of the current viewport. For simplicity of the block insertion an AutoLISP command is sent to AutoCAD to do all the work. Yet another nugget gleamed from the <a href="http://through-the-interface.typepad.com/" target="_blank">Through the Interface</a> web site.</p>
<p>Please note that while this code will always insert the block at the upper-right of the viewport, it is possible that this block may not be visible, or be only partially visible, due to the twist angle of that viewport.</p>
<p>Project References: <code>AcDbMgd.dll, AcMgd.dll</code></p>
<p>Sample Code: <code>Visual Studio 2010, C#, .NET Framework 3.5, AutoCAD 2012 Plug-in, .NET ObjectARX</code></p>
<p>Source File: <code>AcadHelper.cs</code></p>
<pre style="line-height: 14px;">// Copyright (C) 2011 by EDA Inc.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// Project references to both AcMgd.dll &amp; AcDbMgd.dll of ObjectARX are required.
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

namespace EDAInc.AcadAPI
{
    internal static class AcadHelper
    {
        // Generates the transformation matrix to go from WCS to DCS
        // units in a view/viewport.
        //      WCS - World Coordinate System
        //      DCS - Display Coordinate System
        // Copied from:
        //      http://through-the-interface.typepad.com/through_the_interface/2011/11/
        //                         navigating-an-autocad-model-using-kinect-part-1.html
        //
        // To get a DCS to WCS transformation matrix, use the inverse of
        // the return matrix.  E.g.,
        //      Matrix3d dcs2wcs = Wcs2Dcs(vtr).Inverse();
        //
        public static Matrix3d Wcs2Dcs(AbstractViewTableRecord vtr)
        {
            Matrix3d mat = Matrix3d.PlaneToWorld(vtr.ViewDirection);
            mat = Matrix3d.Displacement(vtr.Target - Point3d.Origin) * mat;
            mat = Matrix3d.Rotation(
                    -vtr.ViewTwist, vtr.ViewDirection, vtr.Target) * mat;
            return mat.Inverse();
        }

        public static bool GetActiveViewportExtents(Document aDoc,
                                                    out Point3d aMinExtWCS,
                                                    out Point3d aMaxExtWCS)
        {
            if (aDoc == null)
                aDoc = Application.DocumentManager.MdiActiveDocument;
            Database db = aDoc.Database;
            Editor ed = aDoc.Editor;

            using (Transaction tr = db.TransactionManager.StartTransaction()) {
                try {
                    ed.UpdateTiledViewportsInDatabase();

                    // Open the active view port.
                    ViewportTableRecord vp_rec = (ViewportTableRecord)
                            tr.GetObject(ed.ActiveViewportId, OpenMode.ForRead);

                    // Find the min &amp; max extents of the active view port in the DCS.
                    Point2d center_dcs = vp_rec.CenterPoint;
                    double half_width_dcs = vp_rec.Width / 2;
                    double half_height_dcs = vp_rec.Height / 2;
                    Point3d min_ext_dcs = new Point3d(
                            center_dcs.X - half_width_dcs,
                            center_dcs.Y - half_height_dcs,
                            0);
                    Point3d max_ext_dcs = new Point3d(
                            center_dcs.X + half_width_dcs,
                            center_dcs.Y + half_height_dcs,
                            0);

                    // Convert the min &amp; max extents of the view port to WCS.
                    Matrix3d dcs2wcs = AcadHelper.Wcs2Dcs(vp_rec).Inverse();
                    aMinExtWCS = min_ext_dcs.TransformBy(dcs2wcs);
                    aMaxExtWCS = max_ext_dcs.TransformBy(dcs2wcs);

                    tr.Commit();
                    return true;
                }
                catch (Autodesk.AutoCAD.Runtime.Exception ex) {
                    tr.Abort();
					ed.WriteMessage("\n" + ex.Message + "\n");
                    aMinExtWCS = Point3d.Origin;
                    aMaxExtWCS = Point3d.Origin;
                    return false;
                }
            }
        }
    }
}</pre>
<p>Source File: <code>SampleUsage.cs</code></p>
<pre style="line-height: 14px;">// Copyright (C) 2011 by EDA Inc.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

namespace VendorName.AppName
{
    internal class SampleUsage
    {
        private Document mDoc;   // AutoCAD's drawing window
        private Editor mEd;      // AutoCAD's input/output command-line editor

        // Constructor
        public SampleUsage()
        {
	        // Get the currently active AutoCAD drawing at the time
            // that this class is created.
            mDoc = Application.DocumentManager.MdiActiveDocument;
            mEd = mDoc.Editor;
        }

        public void Test(string aBlockFilename,
                         int aAttributeValue1,
                         string aAttributeValue2)
        {
            // Use the upper-right extents of the current/active view
            // as the default location for the block insertion location.
            Point3d min_exts;
            Point3d max_exts;   // upper-right extent
            AcadHelper.GetActiveViewportExtents(mDoc, out min_exts, out max_exts);

            // Send an AutoLISP command to insert the block.
			// Example syntax:
            //     (command "_insert" "blockname.dwg" '(x y z) xScale yScale angle "1001" "5' - 6\"")
            string lisp_cmd =
                "(command \"_insert\" \"" + aBlockFilename + "\" " +
                    "'(" + max_exts.X.ToString() + " " +
                           max_exts.Y.ToString() + " " +
                           max_exts.Z.ToString() + ") " +
                    "1 1 0 " +  // X,Y scaling of 1; rotation of 0 degrees
                    "\"" + aAttributeValue1.ToString() + "\" " + // 1st attribute of the block
                    "\"" + aAttributeValue2 + "\"" +             // 2nd attribute
                    ")\n";

            // Note: AutoCAD will NOT execute this command string until AFTER this
            //       routine has returned control to AutoCAD.
            mDoc.SendStringToExecute(lisp_cmd, true, false, true);
        }
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://edainc.net/blog/?feed=rss2&#038;p=80</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIY Vertical Mouse</title>
		<link>http://edainc.net/blog/?p=5</link>
		<comments>http://edainc.net/blog/?p=5#comments</comments>
		<pubDate>Tue, 17 Jan 2012 21:12:35 +0000</pubDate>
		<dc:creator>Misa</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[ergonomics]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[SolidSmack]]></category>
		<category><![CDATA[trackball]]></category>

		<guid isPermaLink="false">http://edainc.net/blog/?p=5</guid>
		<description><![CDATA[I often find myself in need of SolidWorks tips &#38; tricks (even as a Certified SolidWorks Professional) so today I was scanning the SolidSmack.com blog and I saw this post about an ergonomic vertical mouse: http://solidsmack.com/3d-cad-technology/evoluent-vertical-mouse-design/ I was so bummed because my trackball mouse just died recently and I had to order a new one. [...]]]></description>
			<content:encoded><![CDATA[<p>I often find myself in need of SolidWorks tips &amp; tricks (even as a Certified SolidWorks Professional) so today I was scanning the SolidSmack.com blog and I saw this post about an ergonomic vertical mouse:</p>
<p><a href="http://solidsmack.com/3d-cad-technology/evoluent-vertical-mouse-design/" target="_blank">http://solidsmack.com/3d-cad-technology/evoluent-vertical-mouse-design/</a></p>
<p>I was so bummed because my trackball mouse just died recently and I had to order a new one. I wished I had seen this post first, because it really does look like a more comfortable position for your hand and more ergonomically correct. I use my trackball all day, and while it is much better for my wrist &amp; hand than a regular mouse, I often still have issues with my mouse hand/arm.</p>
<p>I guess the vertical mouse has been around since the mid 90&#8242;s but this was the first time I&#8217;d ever seen one. But did I really want to throw away my new trackball &amp; shell out $90 for a new one?</p>
<div id="attachment_52" class="wp-caption alignnone" style="width: 229px"><a href="http://edainc.net/blog/wp-content/uploads/2012/01/Trackball1.png"><div class="swpf-img"><img class="size-medium wp-image-52" title="Trackball" src="http://edainc.net/blog/wp-content/uploads/2012/01/Trackball1-219x300.png" alt="Trackball mouse" width="219" height="300" /></div></a><p class="wp-caption-text">Not as ergonomic as it could be.</p></div>
<p>Then the light bulb went on.</p>
<p>See picture below to see how to turn your regular trackball mouse into a vertical mouse. It totally works! I like my &#8220;new&#8221; vertical mouse so much better!</p>
<div id="attachment_53" class="wp-caption alignnone" style="width: 310px"><a href="http://edainc.net/blog/wp-content/uploads/2012/01/NewMouse.png"><div class="swpf-img"><img class="size-medium wp-image-53" title="NewMouse" src="http://edainc.net/blog/wp-content/uploads/2012/01/NewMouse-300x298.png" alt="Trackball supported by hard drive case" width="300" height="298" /></div></a><p class="wp-caption-text">DIY strikes again!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://edainc.net/blog/?feed=rss2&#038;p=5</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to save a .SAT file using the Solid Edge ST4 API.</title>
		<link>http://edainc.net/blog/?p=13</link>
		<comments>http://edainc.net/blog/?p=13#comments</comments>
		<pubDate>Fri, 06 Jan 2012 00:40:13 +0000</pubDate>
		<dc:creator>Madison</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Solid Edge]]></category>
		<category><![CDATA[Solid Edge SAT API Automation]]></category>

		<guid isPermaLink="false">http://edainc.net/blog/?p=13</guid>
		<description><![CDATA[I recently discovered a &#8220;special feature&#8221; in Solid Edge ST4 that presents an interesting challenge when trying to save a .SAT file through the API. Solid Edge would freeze solid and never return. The call below caused Solid Edge to lock up: mSE.ActiveDocument.SaveAs(@"C:\Path\File.SAT"); &#160; I Googled for a solution and found this post indicating that saving [...]]]></description>
			<content:encoded><![CDATA[<p>I recently discovered a &#8220;special feature&#8221; in Solid Edge ST4 that presents an interesting challenge when trying to save a .SAT file through the API. Solid Edge would freeze solid and never return. The call below caused Solid Edge to lock up:</p>
<pre>mSE.ActiveDocument.SaveAs(@"C:\Path\File.SAT");</pre>
<p>&nbsp;</p>
<p>I Googled for a solution and found <a href="http://www.deelip.com/?p=4607." target="_blank">this post</a> indicating that saving a SAT file through the User Interface used to be a problem with Solid Edge in ST3, however it was fixed in <a href="http://www.deelip.com/?p=5174" target="_blank">ST3 Maintenance Pack 1</a>. Apparently only saving a .SAT file through the UI was corrected, saving a .SAT file through the API still presents a challenge.<br />
<span id="more-13"></span><br />
I tried many, many work arounds to solve the issue, but I will not bore you with the details of each failed attempt. What finally worked was starting Solid Edge by using <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx">Process.Start</a> instead of starting Solid Edge with <a href="http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx">Activator.CreateInstance</a>.</p>
<p>When starting Solid Edge with Activator.CreateInstance the &#8220;-Automation&#8221; parameter is set, typically you want this to be set when using the API, however Solid Edge will not save a .SAT file when this parameter is set. Starting Solid Edge with Process.Start the  &#8220;-Automation&#8221; parameter is NOT set, it is basically like double clicking the Solid Edge icon.</p>
<p>With the -Automation parameter not set Solid Edge will save .SAT files as expected, even through the API.</p>
<p>Of course this presents a few other problems. Without the -Automation parameter Solid Edge will display prompts, this can lock up the API, so make sure to set DisplayAlerts = false. Also, if you are using a trial version of Solid Edge the Solid Edge Licence warning will be displayed when you start Solid Edge with Process.Start, so you will have to dismiss this dialog using the Windows API. Also, Solid Edge takes some time to start up, so you will have to wait for it to be started before you can connect to it.</p>
<p>My old startSolidEdge function looked like this:</p>
<pre>        private bool startSolidEdge()
            {
            try
                {
                // Get the type from the Solid Edge ProgID
                WriteToLog("Starting Solid Edge");
                Type type = Type.GetTypeFromProgID("SolidEdge.Application");
                // Start Solid Edge
                mSE = (SolidEdgeFramework.Application)
                  Activator.CreateInstance(type);

                WriteToLog("Solid Edge Started");

                return true;
                }
            catch (System.Exception ex)
                {
                    WriteToLog("Failed to Start Solid Edge", EventLogEntryType.Error);
                    throw new Exception("Could not start SOLID EDGE " + ex.Message);
                }
            }</pre>
<p>&nbsp;</p>
<p>My new startSolidEdge function looks like this:</p>
<pre>       private bool startSolidEdge(string aPathToSolidEdgeEXE)
            {
            try
                {
                    WriteToLog("Starting Solid Edge");
                    Process.Start(aPathToSolidEdgeEXE);

                    //Sleep in case the licensing splash screen appears
                    Thread.Sleep(5000);

                    //close the splash screen if it is open
                    KillWindowByTitle("Solid Edge Licensing");

		    //Give SE 90 seconds to start
                    int maxNumberOfTries = 18;
                    int numberOfTries = 0;

                    while (mSE == null &amp;&amp; numberOfTries &lt; maxNumberOfTries)
                        {
                        try
                            {
                            Thread.Sleep(5000);
                            mSE = (SolidEdgeFramework.Application)
                                  Marshal.GetActiveObject("SolidEdge.Application");
                            }
                        catch
                            {
                            numberOfTries+= 1;
                            }
                        }

                    if (mSE == null)
                        {
                        return false;
                        }

                    mSE.DisplayAlerts = false;
                    mSE.ShowStartupScreen = false;
                    mSE.Visible = true;
                    mSE.WindowState = 1;

                WriteToLog("Solid Edge Started");

                return true;
                }
            catch (System.Exception ex)
                {
                    WriteToLog("Failed to Start Solid Edge", EventLogEntryType.Error);
                    throw new Exception("Could not start SOLID EDGE " + ex.Message);
                }
            }</pre>
<p>Hope this helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://edainc.net/blog/?feed=rss2&#038;p=13</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Happy New Year!</title>
		<link>http://edainc.net/blog/?p=6</link>
		<comments>http://edainc.net/blog/?p=6#comments</comments>
		<pubDate>Wed, 04 Jan 2012 00:09:11 +0000</pubDate>
		<dc:creator>Misa</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://edainc.net/blog/?p=6</guid>
		<description><![CDATA[Happy New Year from the staff at EDA!]]></description>
			<content:encoded><![CDATA[<p><a href="http://edainc.net/blog/wp-content/uploads/2012/01/RIMG4896.jpg"><div class="swpf-img"><img class="aligncenter size-medium wp-image-8" title="Mount Baker from Bellingham, WA" src="http://edainc.net/blog/wp-content/uploads/2012/01/RIMG4896-300x225.jpg" alt="MountBaker" width="300" height="225" /></div></a></p>
<p style="text-align: center;">Happy New Year from the staff at EDA!</p>
]]></content:encoded>
			<wfw:commentRss>http://edainc.net/blog/?feed=rss2&#038;p=6</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

