Author Topic: How to display an end point  (Read 6646 times)

0 Members and 1 Guest are viewing this topic.

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #15 on: January 18, 2018, 04:53:41 PM »
Super ! thanks mr. Lee
updated my code in the above.
This doesn't work..(?)

(cond
..
 (= "ARC" (cdr (assoc 0 (setq enx (entget ent))))))
Design is something you should do with both hands. My 2d hand , my 3d hand ..

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: How to display an end point
« Reply #16 on: January 18, 2018, 04:55:04 PM »
I would suggest studying the documentation for the cond function - you are using the wrong syntax.

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #17 on: January 19, 2018, 05:11:36 AM »
Got it to work, except the properties don't show.
*edit: it does now*

Code: [Select]

(defun c:showSE (/ ent enx)

 (load "GrTextV1-1.lsp") ; Lee Mac

  ;; Display GrText  -  Lee Mac
  ;; pnt  -  cursor point in UCS
  ;; vec  -  GrText vector list
  ;; col  -  Text Colour (ACI Colour)
  ;; xof  -  x-offset from cursor in pixels
  ;; yof  -  y-offset from cursor in pixels
  (if (and (setq ent (car (entsel "\nSelect a (poly)line: ")))
   (or
     (= "LWPOLYLINE" (cdr (assoc 0 (setq enx (entget ent)))))
     (= "LINE" (cdr (assoc 0 (setq enx (entget ent)))))
     (= "ARC" (cdr (assoc 0 (setq enx (entget ent)))))
     (= "SPLINE" (cdr (assoc 0 (setq enx (entget ent)))))
     (= "POLYLINE" (cdr (assoc 0 (setq enx (entget ent)))))
   )
      )
    (progn

      (LM:grx (trans (cdr (assoc 10 enx)) ent 0) 5 3)
      (LM:grx (trans (cdr (assoc 10 (reverse enx))) ent 0) 5 1)
      (setq ptS (vlax-curve-getStartPoint ent))
      (setq ptE (vlax-curve-getEndPoint ent))
      (LM:grx ptS 5 3)
      (LM:grx ptE 5 1)
      (LM:DisplayGrText ptS (LM:GrText (strcat "S")) 3 10 -25)
      (LM:DisplayGrText ptE (LM:GrText (strcat "E")) 1 10 -25)
      (setq ptS nil)
      (setq ptE nil)
      (sssetfirst nil (ssadd ent (ssadd)))
    )
   
  )
 ; (princ)
)



« Last Edit: January 19, 2018, 10:06:38 AM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How to display an end point
« Reply #18 on: January 19, 2018, 09:22:20 AM »
Instead of the command call, use this:
Code: [Select]
(sssetfirst nil (ssadd ent (ssadd)))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #19 on: January 19, 2018, 09:27:16 AM »
Thank you ronjomp!
Design is something you should do with both hands. My 2d hand , my 3d hand ..

ronjonp

  • Needs a day job
  • Posts: 7529
Re: How to display an end point
« Reply #20 on: January 19, 2018, 10:37:22 AM »
You're welcome :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

dubb

  • Swamp Rat
  • Posts: 1105
Re: How to display an end point
« Reply #21 on: January 19, 2018, 12:06:09 PM »
Got it to work, except the properties don't show.
*edit: it does now*

Looks beautiful!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to display an end point
« Reply #22 on: January 19, 2018, 01:05:30 PM »
@Hans:
IMO these lines can be removed:
Code: [Select]
      (LM:grx (trans (cdr (assoc 10 enx)) ent 0) 5 3)
      (LM:grx (trans (cdr (assoc 10 (reverse enx))) ent 0) 5 1)
And there are some issues regarding coordinate systems.
« Last Edit: January 19, 2018, 02:04:08 PM by roy_043 »

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #23 on: January 19, 2018, 02:03:51 PM »
You're right, Roy.
It's only noice in my case.
Thanks for improvements!
« Last Edit: January 19, 2018, 02:11:02 PM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: How to display an end point
« Reply #24 on: January 19, 2018, 02:08:19 PM »
Hans, you could shorten the evaluations within the and function:

Code: [Select]
(and
  (setq ent (car (entsel "\nSelect a (poly)line: ")))
  (member (cdr (assoc 0 (setq enx (entget ent)))) '("LWPOLYLINE" "LINE" "ARC" "SPLINE" "POLYLINE"))
  (not (vlax-curve-isClosed ent)) ; so it will be an open curve
)
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

lamarn

  • Swamp Rat
  • Posts: 636
Re: How to display an end point
« Reply #25 on: January 19, 2018, 02:12:25 PM »
Aha. Member! A lot more professional ..;-) credits to yo all
Design is something you should do with both hands. My 2d hand , my 3d hand ..

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to display an end point
« Reply #26 on: January 19, 2018, 02:23:00 PM »
@Lee:
I wonder if your LM:grx function is correct. Shouldn't it be?:
Code: [Select]
;; grX  -  Lee Mac
;; p - [lst] WCS point at which to display 'X'
;; s - [int] size of point (in pixels)
;; c - [int] ACI colour of point
;; Returns supplied WCS point.

(defun LM:grx (p s c / -s r q)
  (setq r  (/ (getvar 'viewsize) (cadr (getvar 'screensize)))
        q  (trans p 0 1) ; <------- Modified
        -s (- s)
  )
  (grvecs
    (list c
    (list -s -s)
    (list s s)
    (list -s (1+ -s))
    (list (1- s) s)
    (list (1+ -s) -s)
    (list s (1- s))
    (list -s s)
    (list s -s)
    (list -s (1- s))
    (list (1- s) -s)
    (list (1+ -s) s)
    (list s (1+ -s))
    )
    (list
      (list r 0. 0. (car q))
      (list 0. r 0. (cadr q))
      (list 0. 0. r (caddr q)) ; <------- Modified
      (list 0. 0. 0. 1.)
    )
  )
  p
)

Something similar applies to the LM:displaygrtext function that Hans uses in his code.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: How to display an end point
« Reply #27 on: January 19, 2018, 06:09:58 PM »
@Lee:
I wonder if your LM:grx function is correct. Shouldn't it be?:

Code: [Select]
< ... >
Something similar applies to the LM:displaygrtext function that Hans uses in his code.

No, as the vector graphics should be displayed relative to the display (DCS), regardless of UCS/View.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to display an end point
« Reply #28 on: January 20, 2018, 05:09:03 AM »
Thanks for your answer Lee. Hans has started a related thread on the BricsCAD forum and it seems that BC is incompatible here:
There is a known incompatible behavior with the (grvecs) function in BricsCAD. On Acad it accepts DCS coordinates, in BricsCAD UCS.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: How to display an end point
« Reply #29 on: January 20, 2018, 08:57:57 AM »
Thanks for your answer Lee. Hans has started a related thread on the BricsCAD forum and it seems that BC is incompatible here:
There is a known incompatible behavior with the (grvecs) function in BricsCAD. On Acad it accepts DCS coordinates, in BricsCAD UCS.

Thanks Roy - that clears things up.