[求助]如何得到ucs和wus之间的夹角(已解决)
本帖最后由 作者 于 2009-9-29 8:29:14 编辑 <br /><br /> <p> blockRefObj.Rotation = ThisDrawing.Utility.AngleFromXAxis(ThisDrawing.GetVariable("UCSORG"), _<br/> ThisDrawing.GetVariable("UCSXDIR"))</p><p>用这样的方法 块的旋转角度似乎是随机性的</p><p>详见5楼</p> <a href="http://www.mjtd.com/object/acad2004/idh_getucsmatrix.htm">http://www.mjtd.com/object/acad2004/idh_getucsmatrix.htm</a> <p>斑竹 UcS是已经有了的 如何获取啊 </p><p>能不能演示一下 </p> <p>参考了网上的代码</p><p> Dim CurrUCS As AcadUCS<br/> If ThisDrawing.GetVariable("UCSNAME") = "" Then<br/> With ThisDrawing<br/> Set CurrUCS = .UserCoordinateSystems.Add( _<br/> .GetVariable("UCSORG"), _<br/> .GetVariable("UCSXDIR"), .GetVariable("UCSYDIR"), _<br/> "OriginalUCS")<br/> End With<br/> Else<br/> Set CurrUCS = ThisDrawing.ActiveUCS 'current UCS is saved<br/> End If<br/> blockRefObj.TransformBy (CurrUCS.GetUCSMatrix())</p><p>结果是块角度没变</p><p>其中有段代码改一下</p><p> .Utility.TranslateCoordinates(.GetVariable("UCSXDIR"), acUCS, acWorld, 0), _<br/> .Utility.TranslateCoordinates(.GetVariable("UCSYDIR"), acUCS, acWorld, 0), _<br/>这样块的角度就是ucs的两倍角(特殊情况下不一定)</p><p>怎么会这样啊 真是无语了</p> <p> Dim P0(2) As Double <br/> Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(P1, TreeView1.SelectedItem.Key, 1, 1, 1, 0, KeyW)<br/> P0(0) = 0<br/> P0(1) = 0<br/> P0(2) = 0<br/> blockRefObj.Rotation = ThisDrawing.Utility.AngleFromXAxis(P0, ThisDrawing.GetVariable("UCSXDIR"))<br/></p>
页:
[1]