How to find Primary Point Group using vlisp

How to find Primary Point Group using vlisp

tcorey
Mentor Mentor
1,033 Views
5 Replies
Message 1 of 6

How to find Primary Point Group using vlisp

tcorey
Mentor
Mentor

When I use the AutoCAD List command on a Civil 3d Point, one reported datum is Primary Point Group.

 

I want to get at that information with vlisp, but when I vlax-dump a point, there is no mention of Primary Point Group. If that's a limitation of using vlisp, let me know, and I won't chase it. 

 

Maybe I have to go in through the point groups collection?



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Accepted solutions (1)
1,034 Views
5 Replies
Replies (5)
Message 2 of 6

Jeff_M
Consultant
Consultant
Accepted solution

Yes, you need to iterate the pointgroups:

(defun getprimarypointgroup (pt c3ddoc / IDX PTGRP)
  (setq idx -1)
  (vlax-for grp	(vlax-get-property c3ddoc 'pointgroups)
    (if	(and (= (vlax-invoke-method grp 'containspoint (vlax-get-property pt 'number)) :vlax-true)
	     (> (vlax-get-property grp 'DrawPriority) idx)
	     )
      (progn
	(setq idx (vlax-get-property grp 'DrawPriority))
	(setq ptgrp grp)
      )
    )
  )
  ptgrp
)

 

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 6

tcorey
Mentor
Mentor

Thanks, Jeff.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 4 of 6

tcorey
Mentor
Mentor

Jeff, at the end, where you have "ptgrp" out there by itself, is that like using a Return statement in c++? 

 

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 5 of 6

tcorey
Mentor
Mentor

When in doubt, give it a try. Yes, that works like a Return.

 

That's slick, Jeff. I didn't know lisp allowed that.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 6 of 6

Jeff_M
Consultant
Consultant

Yep, lisp always returns the last thing it does. That's why most programs will end with (princ) so it exits 'quietly' instead of spitting out nil or some other value from the last used variable/calculation.

 

 

Jeff_M, also a frequent Swamper
EESignature
0 Likes