Jump to content

Re-Associate WCS/Orthographic Views

Recommended Posts









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:



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);





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