Jump to content

Change a length of line by feeding a new end point to the association list.


Recommended Posts

Posted

I can get the Association list of a line with  entget .

Please help me feed to new values to this list.

Posted (edited)

to update entmod you need to get familiar with dxf codes. This simple lisps will dump to the command line. All entities follow a pattern.

 

;;----------------------------------------------------------------------------;;
;; Dump all DXF Group Data             
(defun C:DumpIt (/ ent)
  (while (setq ent (car (entsel "\nSelect Entity to Dump")))
    (mapcar 'print (entget ent '( "*")))
  )
  (princ)
)
;;----------------------------------------------------------------------------;;
;; Dump All Visual Lisp Methods and Properties for Selected Entity
(defun C:VDumpIt (/ ent)
  (while (setq ent (car (entsel "\nSelect Entity to Dump")))
    (vlax-Dump-Object (vlax-Ename->Vla-Object ent) t)
  )
  (princ)
)

 

 

entsel will return an entity name and point of seleciton. use that to see which endpoint your closest to. and use that to update with entmod and entupd.

;;----------------------------------------------------------------------------;;
;; Extend line to new point.
;; https://www.cadtutor.net/forum/topic/98936-change-a-length-of-line-by-feeding-a-new-end-point-to-the-association-list/
(defun c:EXTLINE ( / sel ent pick line sp ep newpt)
  (if (setq sel (entsel "\nSelect line near the end to extend: "))
    (progn
      (setq ent (car sel)
            pt (cadr sel)
            line (entget ent)
      )
      (if (= (cdr (assoc 0 line)) "LINE")
        (progn
          (setq sp (cdr (assoc 10 line)))
          (setq ep (cdr (assoc 11 line)))
          (if (< (distance pt sp) (distance pt ep))
            (setq newpt (getpoint ep "\nSpecify new endpoint: ")
                  line (subst (cons 10 newpt) (assoc 10 line) line)
            )
            (setq newpt (getpoint sp "\nSpecify new endpoint: ")
                  line (subst (cons 11 newpt) (assoc 11 line) line)
            )
          )
          (entmod line)
          (entupd ent)
        )
        (prompt "\nSelected entity is not a LINE.")
      )
    )
  )
  (princ)
)
Edited by mhupp
Added notes to lisp
  • Thanks 1
Posted (edited)

I looked at this and started to do move end point of a pline, then realised you state "Extend line" rather than move end point to a new point. So you can move the "end" point of a line or Pline to a point with one code That is different to say make a new length.

 

If you think about it don't need code just pick line/pline then grips are exposed pick an end or vertice and move it to the new point. 

 

So can you explain more what it is your trying to do ? A dwg before after etc.

Edited by BIGAL

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...