Jump to content

How to get attribute to report the size of a custom shape?


Recommended Posts

Hello everyone, I hope y'all are doing well.

 

I've created a custom tree shape/symbol consists of multiple circles joining together. I then turned them into a single block, Within the block, I have added a 'Linear Parameter' with a 'Scale Action' applied to it. So whenever I drag the linear arrow - it'll scale the tree symbol. 

 

My Issue is that when I selected the tree block, the attribute list for the tree block doesn't have anything that indicates its size. Whereas, for a circle shape, there's a 'diameter' in the attribute list but i'm not seeing it for my custom tree shape/block. Is there anyway to get around the issue? Please see attached diagram. 

 

Like always, Thank you for your time and any advice is greatly appreciated! 

 

Have a good day :)

tree_shape.PNG

Link to post
Share on other sites
tombu

Why not just take advantage of Civil 3D's features? 

Our trees are imported scaled by the tree diameters.

I have one Tree Description Key set that adds the diameter and description as the label and another that simply puts the point number in the center of the tree as the label referenced by a tree table.

 

  • Like 1
Link to post
Share on other sites
BIGAL

Like tombu I have trunk and spread trees as single dynamic block, if the original block is drawn as 1 unit dia  in size then its scale function reflects its size. If its dynamic same thing can get property value that is size and say label.

 

Should post block so can look at it.

Edited by BIGAL
  • Like 1
Link to post
Share on other sites
CyberAngel

Could you add a non-plotting circle to the block and use that diameter for your attribute? You might have to experiment to find the right size for the circle so that it matches the tree (if I'm interpreting the question properly), but once you do that, you've got what you need.

  • Like 1
Link to post
Share on other sites
tombu

For our Tree Description Key set code CRM Point Label Style is "Description Only", Format is "$1" Crape Myrtle", Layer is "V-SITE-VEGE", Scale Parameter 1 checked, Fixed Scale Factor 1 checked, and Apply X-Y Yes checked.

Using just a standard tree block a point with "CRM 18" as the description will be scaled 18× and labeled as 18" Crape Myrtle automatically when imported.

Pretty simple.

 

To mark a tree as "To Be Removed" or "Technically removed" I use this code saved as "TreeToBeRemoved.lsp" in a folder both in my Support Path and Trusted Folders.

; by: Tom Beauford
(defun TBR ( )
;(defun TBR ( / ss ent obj hscale pt clayer )
  (setq ss (ssget "+.:E:S" '((0 . "AECC_COGO_POINT")(8 . "V-SITE-VEGE")))
		ent (ssname SS 0)
		obj (vlax-ename->vla-object ent)
		east (vlax-get-property obj 'Easting)
		north (vlax-get-property obj 'Northing)
		pt (list east north)
		hscale (*(vlax-get-property obj 'XYScale)(getvar 'cannoscalevalue))
		clayer (getvar 'clayer)
  )
  (princ pt)(princ "\n")
  (if (/= (getvar 'annoallvisible) 1)(progn(setvar 'annoallvisible 1)(princ "\nDisplays all annotative objects. ANNOALLVISIBLE")))
  (setvar 'clayer "V-SITE-VEGE")
)

; ^P(or C:TBR (load "TreeToBeRemoved.lsp"));TBR
; (load "TreeToBeRemoved.lsp")TBR
(defun C:TBR ( / ss ent obj hscale pt clayer ) (princ "\nSelect Tree to be Removed ")
;  (or C:Steal (load "StealV1-8.lsp"))
  (TBR)
  (or(tblsearch "block" "TBR")(command-s  "-insert" "TBR" pt hscale hscale ""))
  (setq hscale (*(vlax-get-property obj 'XYScale)(getvar 'cannoscalevalue)))
  (princ "\nhscale")(princ hscale)
  (command-s  "-insert" "TBR" pt hscale hscale "")
  (setvar 'clayer clayer)
  (princ)
)

; ^P(or C:TCH (load "TreeToBeRemoved.lsp"));TCH
; (load "TreeToBeRemoved.lsp")TCH
(defun C:TCH ( / ss ent obj hscale pt clayer ) (princ "\nSelect Tree to be TeCHnically removed ")
;  (or C:Steal (load "StealV1-8.lsp"))
  (TBR)
  (or(tblsearch "block" "TCH")(command-s  "-insert" "TCH" pt hscale hscale ""))
  (setq hscale (*(vlax-get-property obj 'XYScale)(getvar 'cannoscalevalue)))
  (princ "\nhscale")(princ hscale)
  (command-s  "-insert" "TCH" pt hscale hscale "")
  (setvar 'clayer clayer)
  (princ)
)

; ^P(or C:CPZ (load "TreeToBeRemoved.lsp"));CPZ
; (load "TreeToBeRemoved.lsp")CPZ
(defun C:CPZ ( / ss ent obj hscale pt clayer ) (princ "\nSelect Tree to add CPZ ")
  (TBR)
  (setq hscale (vlax-get-property obj 'XYScale))
  (princ "\nhscale")(princ hscale)
  (command-s  "_Circle" pt "Diameter" hscale)
  (setvar 'clayer clayer)
  (princ)
)

to place an Annotative block with Match orientation to layout set to Yes and scaled the same as the selected Civil 3D tree block on top with these macros:

^P(or C:TBR (load "TreeToBeRemoved.lsp"));TBR
and
^P(or C:TCH (load "TreeToBeRemoved.lsp"));TCH
and
^P(or C:TCH (load "TreeToBeRemoved.lsp"));CPZ

Since they're separate blocks placed on top of the Civil 3D tree blocks to change the status just delete whatever TBR or TCH block if you want.

 

You're making this a lot harder than it has to be.

Edited by tombu
Added CPZ Critical Protection Zone code and macro.
  • Thanks 1
Link to post
Share on other sites

@CyberAngel Thanks for the suggestion but what's a non-plotting circle? and how do I create such object? it may be the answer to my issue. 

 

@tombu Thanks for the reply. I have tried using the description key to create and scale the tree symbol but it can only scale the whole tree symbol as a whole, I would like a smaller circle to indicate the trunk diameter and a curly round symbol to represent the canopy spread. Hence, I wanted to create a dynamic block containing both the trunk + canopy spread symbol that could be dragged to scale accordingly by the user.

 

@BIGAL Thanks Bigal, it's good to see you again. I have been using the tree block symbol that you shared a few weeks ago. It's working really well though I got a few comments that the tree symbol looks too much like  a lily pad, so that's why I want to create a new round curly shape to look more like a tree. I tried to modify your poly-circle but that didn't work out too well since the attribute list doesn't have the dimension or size attribute field. 

 

Please see attached files. 

The treedyn.dwg was provided by Bigal which I have been using.

The tree_WIP.dwg is still a work in process. For some reason, the attribute values don't show up in the model space. But when I tested it out in the Block Editor menu, the attribute values for the tree diameter and the canopy spread do show up. Though I have to use the 'regen' command to update the attribute text (inside the test block editor) to update the value every time after scaling the shapes via the slider arrows. Is it possible to get the attribute value to show up in the model space and the value to update automatically every time I drag the arrow? it's a hassle having to type regen constantly. 

 

I'm doing it this way so that I can easily scale the tree over a tree on Geolocation map. 

 

Thanks everyone for your advice and suggestions. I greatly appreciate them all. Have a good week :)

 

 

 

 

 

Tree_WIP.dwg treedyn.dwg

Link to post
Share on other sites
17 minutes ago, Alexv said:

@tombu thanks for sharing the code, I'll test it out. 

I added the rest of the code that adds a circle equal to the Critical Protection Zone to a selected tree. If needed I can select and shrink-wrap them with the Civil 3D LineworkShrinkwrap command.

As the or function only requires one True value it stops evaluating when it finds it. I use it in macros to test if a function is already defined and load it if it isn't.

^P(or C:TCH (load "TreeToBeRemoved.lsp"));CPZ

Why not just add a circle to the center of your block with a diameter of 1/12 that would scale to display the trunk size?

Link to post
Share on other sites

A "non-plotting circle" is like any other circle except that it's on a layer with the "plot" property turned off. In this case, it's there as a anchor for your Scale Action, but it won't show up in your finished plan.

Link to post
Share on other sites

You can make the Treedyn block any shape you want the stretch parameter is for this simple block applied to a  pline and the other to a simple 1 dia circle. You can make the tree look as complicated as you like just need to select all the tree parts not the circle when applying the dynamic stretch property to the original block in say BEDIT. Can have as many as you want for look and feel of different trees. The lisp that goes with the block looks at a  civ3d coggo point description getting the parameters from that.

Edited by BIGAL
Link to post
Share on other sites

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
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...