Skip to content

Instantly share code, notes, and snippets.

Ben Koshy BKSpurgeon

  • Bangalore, India
Block or report user

Report or block BKSpurgeon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@BKSpurgeon
BKSpurgeon / autocad-dot-order-IntersectionPoints-partII.md
Last active May 9, 2019
Print Staggered and Offset Intersection Lines (AutoCAD .net API)
View autocad-dot-order-IntersectionPoints-partII.md

Client Code

Refer here for Part 1: because only the relevant and necessary code is pasted here:

        [CommandMethod("GetIntersectionPoints", CommandFlags.UsePickSet)]
        public static void IntersectionPoints()
        {
            try
@BKSpurgeon
BKSpurgeon / autocad-dot-order-IntersectionPoints.md
Last active May 9, 2019
Get and Ordered List of Intersection Points
View autocad-dot-order-IntersectionPoints.md

The following allows us to get an ordered list of intersection points, along a particular direction:

The Client

 [CommandMethod("GetIntersectionPoints", CommandFlags.UsePickSet)]
        public static void IntersectionPoints()
        {
            try
            {
                Document doc = Application.DocumentManager.MdiActiveDocument;
@BKSpurgeon
BKSpurgeon / autocad-dot-orderingLines.md
Last active May 6, 2019
Ordering Selected lines by their Starting Point X Coordinate Value
View autocad-dot-orderingLines.md
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using System.Collections.Generic;
using System.Linq;

        [CommandMethod("OrderLines", CommandFlags.UsePickSet)]
@BKSpurgeon
BKSpurgeon / autocad-dot-net-pre-message-filter-tab.md
Created Apr 19, 2019
Premessage Filter - catch instance of users pressing the tab button
View autocad-dot-net-pre-message-filter-tab.md

In my case I want to catch instance where the user has pressed the tab button in a jig. I will paste only the relevant parts (i.e. omitting the constructor and overriden methods):

    internal class BlockReferenceJig : DrawJig, System.Windows.Forms.IMessageFilter
    {
        private const int WM_KEYDOWN = 0x0100;

        public bool PreFilterMessage(ref Message m)
        {
            if (m.Msg != WM_KEYDOWN)
@BKSpurgeon
BKSpurgeon / test-colinearity-dot-net-api.md
Created Apr 12, 2019
Tests the Collinearity of LineSegment2d objects (AutoCAD .net API)
View test-colinearity-dot-net-api.md
        [CommandMethod("TestCollinearity")]
        public void TestCollinearity()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            try
            {
@BKSpurgeon
BKSpurgeon / section_note_jig.md
Created Apr 11, 2019
Precast Tools - Section and note insert
View section_note_jig.md
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
@BKSpurgeon
BKSpurgeon / figures_of_speech.md
Last active Mar 6, 2019
Ella Baron - 27 Figures of Speech
View figures_of_speech.md
@BKSpurgeon
BKSpurgeon / So-help-user-signed-in.md
Last active Feb 5, 2019
SO help - check if user is signed in
View So-help-user-signed-in.md
module SignInHelper
  def sign_in_as(name)
    sign_in users(name)    
    byebug # check here whether the user is signed in.
    
    
    # IMPORTANT: remove the monkey patch because it might not be signing your users in properly
    
  end
@BKSpurgeon
BKSpurgeon / viewDirectionObtainer.md
Created Jan 11, 2019
View Direction Obtainer (AutoCAD .net Sample code - Focusing Mainly on the LineDirectionJigger
View viewDirectionObtainer.md
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;

namespace BKTools.Tools.PrecastTools.LayoutsToElevationsCommand
{
    /// <summary>
    /// We want panel lines that are perpendicular to the rotation of a particular block reference
    /// </summary>
@BKSpurgeon
BKSpurgeon / elm-timesheet-sample-code.md
Created Jan 3, 2019
ELM - Time Sheet App - Sample Code
View elm-timesheet-sample-code.md
  • This is some sample code that I had written to record the time employees punch-in and punch-out.
  • Consequently, we need to keep track of a Shift's start time and end time.
  • These values will need to be sent to a back end server via a post request.
module Main exposing (..)

import Browser
import Html exposing (Html, text, div, h1, img, button)
You can’t perform that action at this time.