+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Full Member
    Discipline
    Electrical
    Using
    AutoCAD 2016
    Join Date
    Apr 2017
    Posts
    74

    Idea M2P and FROM Command Modifiers Using LSP

    Registered forum members do not see this ad.

    Hello, is there a way to combine the move command with the M2P or FROM command modifiers using LISP?

    I would want these to be two separate commands.

    Ideally I would like to program F1 to do _m2p during an active line command and F2 to do from during an active line command... but I'll settle for a lisp that combines each with the move command since I'll be doing that most frequently.

    Thank you in advance!

    P.S. here is code that will draw a line starting at M2P.. sort of a start.

    (defun c:v (/ p1 p2 mid)
    (if (and (setq p1 (getpoint "\nSpecify 1st point of MID :"))
    (setq p2 (getpoint "\nSpecify 2nd point of MID :" p1))
    (setq mid (mapcar '(lambda (q p) (/ (+ q p) 2.)) p1 p2))
    )
    (command "_.pline" "_none" mid)
    )
    (princ)

    )
    Last edited by ryankevin15; 7th Feb 2018 at 11:43 pm.

  2. #2
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,502

    Default

    Maybe some thing like this need to autoload.

    Code:
    (defun c:2 (/ p1 p2 mid)
    (if (and (setq p1 (getpoint "\nSpecify 1st point of MID :"))
    (setq p2 (getpoint "\nSpecify 2nd point of MID :" p1)))
    (setq mid (mapcar '(lambda (q p) (/ (+ q p) 2.)) p1 p2))
    )
    )
    To run say LINE '2 pick 2pts next point etc '2 as required. Using a none for snaps means you dont find the ends for the half point. Looking into 1/4 etc the other thing to look at is CAL it has a number of functions very few people use it but it can do a lot of this type of thing.
    Last edited by BIGAL; 8th Feb 2018 at 09:02 am.
    A man who never made mistakes never made anything

  3. #3
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    12,079

    Default

    Registered forum members do not see this ad.

    Please read the Code Posting Guidelines and edit your Code to be included in Code Tags not Quote Tags.[CODE]Your Code Here[/CODE] =
    Code:
    Your Code Here
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



Similar Threads

  1. Revit Modifiers
    By addesigns in forum Revit General
    Replies: 4
    Last Post: 21st Sep 2015, 03:44 pm
  2. Script Issues: Not performing correct command or skipping command.
    By asad112 in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 13
    Last Post: 23rd Sep 2012, 02:16 am
  3. Replies: 1
    Last Post: 4th Nov 2011, 01:54 pm
  4. TEXT command made in MSexcel fail to execute in command line Autocad 2006 and higher
    By ctdlc888 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 14th Sep 2011, 04:05 am
  5. OTRACK command fails when using floating command line
    By Autodesk in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 3rd Feb 2007, 02:40 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts