See the top rated post in this thread. Click here

Results 1 to 10 of 18

Thread: Perpendicular 2D snap to line

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Perpendicular 2D snap to line

    AutoCAD snaps to Perpendicular in 3D. Need to snap as if line endpoints had the same elevation. I don't want elevation to have any effect on Perpendicular while OSNAPZ is set to 1. Currently I draw a lwpolyline on top to snap to and delete it afterwards.

    Has anyone got any code or ideas? All I could think of would be to do the same with lisp deleting the added line afterwards. Seems like there should be a cleaner process.

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Perpendicular 2D snap to line

    Couldn't you just modify the resultant Curve Object's Elevation Property after the fact?
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Perpendicular 2D snap to line

    Quote Originally Posted by BlackBox View Post
    Couldn't you just modify the resultant Curve Object's Elevation Property after the fact?
    I guess, but how does that help me get ┴ instead of <? Looking for 2D Perpendicular osnap, one that would be Perpendicular if the lines were flattened. Having the Elevation the same as where the lines meet makes sense, but the only thing I'm looking for right now is 2D (or Plan view) Perpendicular osnap. Just can't figure out how to get started on the code.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Perpendicular 2D snap to line

    Backing up for a moment... I may be slow, bare with me... You're wanting to snap perpendicular to a 3D entity when OSNAPZ=1, and have the resultant Curve (i.e., Line, Polyline, etc.) be 2D, correct?
    Last edited by BlackBox; 2013-05-07 at 01:35 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Perpendicular 2D snap to line

    Now I understand... My PERP snap point ends up being off in space, rather than 'near' my actual snap point specification... Lemme see what I can slap together.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Perpendicular 2D snap to line

    Like you've already pointed out, adding a [2D] LWPolyline over top of the [3D] Polyline is the only way I am able to achieve the desire '2d' snap as well.

    Here's a quick automation, that will prevent you from having to manually draw the [2D] LWPolyline... Select the [3D] Polyline, specify your start point, and then the PERP point (of the [3D] Polyline):

    Code:
    (vl-load-com)
    
    (defun c:Perp2d (/ *error* ss oSource oPline)
      (prompt "\nSelect polyline to snap Perp2d: ")
    
    
      (defun *error* (msg)
        (if oSource (vla-highlight oSource :vlax-false))
        (if oPline (vla-delete oPline))
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
    
      (if (and (setq ss (ssget ":S:E" '((0 . "POLYLINE"))))
               (setq oSource (vlax-ename->vla-object
                              (ssname ss 0)
                            )
               )
          )
        (progn
          (vla-highlight oSource :vlax-true)
          (vla-put-layer
            (setq oPline (vla-addpolyline
                         (vla-get-modelspace
                           (vla-get-activedocument (vlax-get-acad-object))
                         )
                         (vla-get-coordinates oSource)
                       )
                  )
            (vla-get-layer oSource)
          )
          (command "._pline" pause "_perp" pause "")
        )
      )
      (*error* nil)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Perpendicular 2D snap to line

    Quote Originally Posted by BlackBox View Post
    Like you've already pointed out, adding a [2D] LWPolyline over top of the [3D] Polyline is the only way I am able to achieve the desire '2d' snap as well.

    Here's a quick automation, that will prevent you from having to manually draw the [2D] LWPolyline... Select the [3D] Polyline, specify your start point, and then the PERP point (of the [3D] Polyline):
    Works great for 3D polylines which is nice. I can add support for lines myself.
    Thanks,

Similar Threads

  1. Multileader snap perpendicular to arc
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2012-06-12, 06:00 PM
  2. Perpendicular & nearest won't snap to arc
    By gadjet in forum AutoCAD General
    Replies: 4
    Last Post: 2007-05-08, 07:13 AM
  3. Replies: 5
    Last Post: 2006-11-09, 07:19 PM
  4. Perpendicular Object Snap
    By SHEILA in forum ACA General
    Replies: 6
    Last Post: 2004-10-06, 06:41 PM
  5. Deferred Perpendicular Snap
    By rpetrie in forum AutoCAD General
    Replies: 3
    Last Post: 2004-10-04, 07:13 AM

Posting Permissions

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