Hi All,
I'm having an issue controlling where my insertion point is located when I create a block using the API. When I use the API, the point is always center of the height of the geometry, and way to the right. I've inserted the drawing geometry at 0,0 when I import it, and I tried supplying an insertion point of 0,0 but it doesn't seem to change anything. Here's the code I'm using, (the important parts anyway), nothing fancy:
<p>SelectionMgr swSelMgr;</p><p></p><p></p><p>swSelMgr = (SelectionMgr)swModel.SelectionManager;</p><p>swModelDocExt.SelectAll();</p><p></p><p></p><p>// Write the block out.</p><p></p><p></p><p>MathUtility swMathUtil = swApp.IGetMathUtility();</p><p>MathPoint swMathPoint;</p><p></p><p></p><p>double[] nPt = new double[3] { 0.0, 0.0, 0.0 };</p><p></p><p></p><p>Object vPt = nPt;</p><p></p><p></p><p>swMathPoint = (MathPoint)swMathUtil.CreatePoint(vPt);</p><p></p><p></p><p>SketchBlockDefinition swBlockDefinition = null;</p><p>swBlockDefinition = ((SketchBlockDefinition)(swModel.SketchManager.MakeSketchBlockFromSelected(swMathPoint)));</p><p></p><p></p><p>string blockFileName = sDwgFileName.Replace(".dwg", ".sldblk");</p><p></p><p></p><p>swBlockDefinition.Save(blockFileName);</p><p>swModel.EditDelete();</p>Am I doing something wrong? When I create the block by hand, the insertion point is always the lower left corner of the geometry bounding box - I initially thought that would be the default behavior in the API as well - I was obviously wrong.
Any help would be appreciated - thanks!
SolidworksApi macros