Author Topic: C3D Point Group Query  (Read 628 times)

rayakmal and 1 Guest are viewing this topic.

CHulse

  • Swamp Rat
  • Posts: 510
C3D Point Group Query
« on: July 05, 2024, 08:59:33 AM »
Hi folks. This question is related to this post:
https://www.theswamp.org/index.php?topic=59660.0

I'm wondering if anyone can give some examples of manipulating/creating point groups and specifically the queries?
I've had this issue of the queries getting messed up and was thinking it might be best to build a lisp to re-create the point groups.

Much appreciated if anyone can point me in the right direction.

Thanks
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

CodeDing

  • Newt
  • Posts: 63
Re: C3D Point Group Query
« Reply #1 on: July 07, 2024, 07:33:57 PM »
CHulse,

Are you familiar with how to retrieve the PointGroups object?
When you explore a Point Group, then the Query Builder, then the Query Statement... You will find an object named 'IAeccQueryLine'. These are where you will build your queries for a point group.

You can find documentation for 'IAeccQueryLine' here:
http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib__IAeccQueryLine.htm

As far as tree symbols from your linked post, are you familiar with Description Keys then? Perhaps it would be easier to manipulate your Raw Descriptions to help associate them with proper symbols & layering?

Description Keys:
https://help.autodesk.com/view/CIV3D/2024/ENU/?guid=GUID-A411F11B-2546-4950-8D5D-FE2FDAE7E75D

Best,
~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

BIGAL

  • Swamp Rat
  • Posts: 1469
  • 40 + years of using Autocad
Re: C3D Point Group Query
« Reply #2 on: July 07, 2024, 08:34:53 PM »
Using raw descriptions for trees you can use a double description, eg Treeg1-6 would be a tree with a block treeg, a trunk 0.1 dia and a spread of 6m.

When importing the points the block is inserted at the point but at scale 1. The block though is a dynamic block so a second step is go through the cogo points and update the dynamic block.

A man who never made a mistake never made anything

CHulse

  • Swamp Rat
  • Posts: 510
Re: C3D Point Group Query
« Reply #3 on: July 08, 2024, 09:04:11 AM »
Thanks CodeDing and BIGAL
We already use some fairly complex description keys for the initial display. We use the UDPs to manipulate tree dispositions and graphics through a project, so it changes as the design does. Too complex to run with description keys alone.

Thanks for the documentation link, very helpful. Do you have any examples of accessing that with lisp?
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

CodeDing

  • Newt
  • Posts: 63
Re: C3D Point Group Query
« Reply #4 on: July 08, 2024, 05:06:53 PM »
CHulse,

Sure thing:
Code - Auto/Visual Lisp: [Select]
  1. ;; Sets *C3D* as global var and *C3DDOC* as global var
  2. ((lambda ( / C3D)
  3.   (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  4.                     (if vlax-user-product-key
  5.                       (vlax-user-product-key)
  6.                       (vlax-product-key)
  7.                     );if
  8.             );strcat
  9.         C3D (vl-registry-read C3D "Release")
  10.         C3D (substr
  11.               C3D
  12.               1
  13.               (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
  14.             );substr
  15.         *C3D* (vla-getinterfaceobject
  16.                 (vlax-get-acad-object)
  17.                 (strcat "AeccXUiLand.AeccApplication." C3D)
  18.               );vla-getinterfaceobject
  19.         *C3DDOC* (vla-get-activedocument *C3D*)
  20.   );setq
  21. ));lambda/eval
  22.  
  23. (defun c:TEST ( / pnt Grps pntGrp qryBldr qryStmts qryStmt)
  24.   (setq pntGrps  (vlax-get *C3DDOC* 'PointGroups)
  25.         pntGrp   (vlax-invoke pntGrps 'Item 0)
  26.         qryBldr  (vlax-get pntGrp 'QueryBuilder)
  27.         qryStmts (vlax-get qryBldr 'QueryStatement) ;<-- This contains the ENTIRE query
  28.         qryStmt  (vlax-invoke qryStmts 'Item 0)     ;<-- This contains ONE LINE of your query ['IAeccQueryLine']
  29.   );setq
  30.   (vlax-dump-object qryStmts t)
  31.   (vlax-dump-object qryStmt t)
  32.   (princ)
  33. );defun

Best,
~DD
« Last Edit: July 08, 2024, 05:14:38 PM by CodeDing »
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

CHulse

  • Swamp Rat
  • Posts: 510
Re: C3D Point Group Query
« Reply #5 on: July 10, 2024, 07:22:47 AM »
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

CHulse

  • Swamp Rat
  • Posts: 510
Re: C3D Point Group Query
« Reply #6 on: July 15, 2024, 12:11:02 PM »
Looking at the output from this, I'm left with more questions than answers I think.
First - it would appear from the "(RO)" that the "Query Text" and "Line Text" entries are read-only? Is this correct? And if so, is there any way to modify them?
Second - the UDP properties I am using seem to be coded (for example, my UDP "T_PRIORITY" is listed as "d0a42b52ad9e40af64a7249474fabf3bT_PRIORITY"). Is there any info on this? Are these values static or dynamic at all?

Appreciate any insight on all this.
Thanks

Output from one of my point groups:
Code: [Select]
Entire query:
; IAeccQueryStatement: IAeccQueryStatement Interface
; Property values:
;   Count (RO) = 2
;   QueryText (RO) = "(d0a42b52ad9e40af64a7249474fabf3bT_PRIORITY=2AND4bacf348b73f454f195cf2ad441058ddT_DISP=TBR)"
;   _NewEnum (RO) = #<IUnknown 000002649136a4e0>
; Methods supported:
;   Add ()
;   Clear ()
;   Item (1)
Line 1:
; IAeccQueryLine: IAeccQueryLine Interface
; Property values:
;   LeftParenthesis = -1
;   LineText (RO) = "(d0a42b52ad9e40af64a7249474fabf3bT_PRIORITY=2"
;   Operator = 1
;   Property = -2130706423
;   RightParenthesis = 0
;   SetOperator = 0
;   Value = nil
; No methods
Line 2:
; IAeccQueryLine: IAeccQueryLine Interface
; Property values:
;   LeftParenthesis = 0
;   LineText (RO) = "AND4bacf348b73f454f195cf2ad441058ddT_DISP=TBR)"
;   Operator = 1
;   Property = -2080374764
;   RightParenthesis = -1
;   SetOperator = 1
;   Value = nil
; No methods
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023