Home > Net >  Cad secondary development
Cad secondary development

Time:11-15

Have a reference block, now need to rotate it 90 degree through code, how to implement?

CodePudding user response:

 Document doc=Application. The DocumentManager. MdiActiveDocument; 
The Database db=doc. Database;
The Editor Ed=doc. Editor;
PromptEntityResult per=Ed GetEntity (new PromptEntityOptions (" \ nSelect a Block "));//select a piece of
If (per the Status!=PromptStatus. OK)
return;
Using (Transaction trans=db. The TransactionManager. StartTransaction ())
{
BlockReference block=per. ObjectId. GetObject (OpenMode. ForWrite) as BlockReference;
Block. The Rotation=block. The Rotation + math.h PI/2.
Trans.Com MIT ();
}
  •  Tags:  
  • C#
  • Related