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

0 Members and 1 Guest are viewing this topic.

CHulse

  • Swamp Rat
  • Posts: 509
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: 1459
  • 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: 509
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: 509
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