Jump to content
SEANT

Re-Associate WCS/Orthographic Views

Recommended Posts

SEANT

http://www.cadtutor.net/forum/showthread.php?84032-UCS-troubles-please-help!!!-)

 

https://forums.autodesk.com/t5/autocad-forum/help-origin-point-of-preset-orthographic-ucs-keeps-changing/m-p/7280067

https://forums.autodesk.com/t5/autocad-forum/reset-the-ucs-to-original/td-p/7651644

 

http://forums.augi.com/showthread.php?169867-How-to-lock-origin-but-have-UCS-adjust

 

This situation is becoming more prevalent so I'm posting a fix here. Even though the problem is cropping up more often, I don't see this routine needing to be run more than once or twice in any CAD users career.

In light of that, I'm not wasting time with bundling this as an addin - it shall remain simply as a NETLOAD to run DLL. For those nervous about pre-compiled code, see the source below.

And, as you can see from the source, the simplicity of the code does not deserve the special treatment of Autodesk's Bundle system.

 

The compiled code is compatible with AutoCAD 2016 - 2018, though it may run on versions prior. More than likely, the unzipped file will need to be UnBlocked before it will run:

https://winaero.com/blog/how-to-unblock-files-downloaded-from-internet-in-windows-10/

 

More than likely, the DLL will need to be on the users system, preferably in the Support File Search Path.

 

// (C) Copyright 2017 by Sean Tessier
//
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;


[assembly: CommandClass(typeof(STSC_ReAssociateViews.STSCCommands))]

namespace STSC_ReAssociateViews
{

   public class STSCCommands
   {

       [CommandMethod("STSCGroup", "ReAssociateViews", "RAV", CommandFlags.Modal)]
       public void OpInit()
       {
           Document doc = Application.DocumentManager.MdiActiveDocument;
           Database Db = doc.Database;

           using (Transaction acTrans = Db.TransactionManager.StartTransaction())
           {
               Db.SetWorldUcsBaseOrigin(new Point3d(), OrthographicView.TopView);
               Db.SetWorldUcsBaseOrigin(new Point3d(), OrthographicView.BottomView);
               Db.SetWorldUcsBaseOrigin(new Point3d(), OrthographicView.FrontView);
               Db.SetWorldUcsBaseOrigin(new Point3d(), OrthographicView.BackView);
               Db.SetWorldUcsBaseOrigin(new Point3d(), OrthographicView.RightView);
               Db.SetWorldUcsBaseOrigin(new Point3d(), OrthographicView.LeftView);

               acTrans.Commit();
           }

       }

   }
}

STSC_ReAssociateViews.zip

Edited by SEANT
Added Commit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×