
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I don't know where else to put this, but, I'm writing an add-on for inventor, and I have a button that imports a block with an arrow. The block can be at 0, 90, 180, or 270 degrees.
When I insert the block like this, however....
TransientGeometry tg = app.TransientGeometry;
dwg.ActiveSheet.AutoCADBlocks.Add(acbd, tg.CreatePoint2d(xLoc, yLoc), (double)md.Orientation, scaleX);
it's behaving...interestingly.
rotation of 0 degrees works. 90 degrees sets it to 116.6, 180 degrees sets it to 233.2, and 270 degrees sets it to 349.9.
Why is inventor adding those extra degrees of rotation??? and why does it seem like the number of degrees added is (degrees / 90 * 26.6 <--- why this number????) ??
here's the full section:
Document blockDefDoc = app.Documents.Open(materialPath, false); if (blockDefDoc.DocumentType == DocumentTypeEnum.kDrawingDocumentObject) { DrawingDocument tedsbomDWG = blockDefDoc as DrawingDocument; AutoCADBlockDefinitions acbds = tedsbomDWG.AutoCADBlockDefinitions; foreach (AutoCADBlockDefinition acbd in acbds) { if (acbd.Name == "material") { acbd.CopyTo(dwg as _DrawingDocument); } } } blockDefDoc.Close(true); foreach (AutoCADBlockDefinition acbd in dwg.AutoCADBlockDefinitions) { if (acbd.Name == "material") { double scaleY = (dwg.ActiveSheet.Height / 8) / 13; double scaleX = (dwg.ActiveSheet.Width / 8) / 30; if (scaleY < scaleX) { scaleX = scaleY; } double xLoc = (dwg.ActiveSheet.Width / 2) - (30 / 2 * scaleX); double yLoc = (dwg.ActiveSheet.Height / 2) - (13 / 2 * scaleX); TransientGeometry tg = app.TransientGeometry; dwg.ActiveSheet.AutoCADBlocks.Add(acbd, tg.CreatePoint2d(xLoc, yLoc), (double)md.Orientation, scaleX); } }
Solved! Go to Solution.