Community
Dynamic Blocks Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynamic slope for ground model

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
AlexKDJ24
494 Views, 11 Replies

Dynamic slope for ground model

Hello there, I am new to creating dynamic blocks and although I have been able to make simple ones, I cannot find a solution to this issue.

Want I want to do is create dynamic block that reads in two Z co-ordinates, measures the distances between them and returns a Gradient 1:xxx with a slope arrow. I can see how you read in the X and Y but not Z and likewise I can create a block with movable grips in X and Y but it does not seem to function in Z. Is this possible? Please can someone help.

11 REPLIES 11
Message 2 of 12
AlexKDJ24
in reply to: AlexKDJ24

Or even an Lisp routine would do, but I was trying to be clever 😃

Message 3 of 12
MMcCall402
in reply to: AlexKDJ24

I put together a sample to show how it could be done.  I used a construction line, an attribute with a field formula with other fields, and a polar parameter with a couple stretch actions to move things around.  The attribute formula takes info from the construction line, its length, end Z and start Z.  When the block is used its grips pick up the elevation of the objects they snap to.

 

MMcCall402_1-1711374387729.png

 

 

MMcCall402_0-1711374310982.png

 

Mark Mccall 
CAD Mangler



Hammer Land Engineering


Linkedin

Message 4 of 12
j.palmeL29YX
in reply to: AlexKDJ24


@AlexKDJ24 wrote:

 

... dynamic block that reads in two Z co-ordinates, 


? "read coordinates" ?

 

Where are the Z-coordinates coming from? Do you want to type the values anywhere or do you want to measure an existing object (or two points) or ... ?

How shall the result look? Can you show us an example?

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 5 of 12
AlexKDJ24
in reply to: MMcCall402

That is awesome! thanks very much and for the quick response!

Message 6 of 12
AlexKDJ24
in reply to: MMcCall402

Thanks again, but on a closer look, this is not giving the correct answer, for instance in the example you sent, the distance between the two points is 94.37 with a rise of 5.0, which should return a gradient of ~1:19 but it does not. It was very close to what I was looking for, but inaccurate.

Message 7 of 12
AlexKDJ24
in reply to: j.palmeL29YX

Thanks for your response Jürgen,

Sorry I was vague, I am trying to measure between two existing entities on a ground model, so similar to the previous answer, I am looking for a block which essentially measures itself. Snap one grip to one end of the surface / area (an existing entity) and snap another grip to another existing entity and the block works out the gradient as a 1:xxx fall with a directional arrow aligned to the block.

Message 8 of 12
AlexKDJ24
in reply to: AlexKDJ24

Mark,

Looking at it again, the problem appears to be coming back to the issue I was having before, that the grips do not appear to pick up changes in Z (elevation) so when you alter the grips on the block it changes the length as intended, but not the change in height (z) therefore does not calculate correctly.

Message 9 of 12
j.palmeL29YX
in reply to: AlexKDJ24

Dynamic block are designed for use in 2D only. So I'm afraid there is no way to get what you want. 

But with a little LISP you can write a tool which askes you for the two points and places the slope text between the two points as shown above. The disadvantage: you can not dynamically drag the points. If you change the geometry, you must delete the slope text and run the LISP again. 

 

If you can life with that handling I can show you tomorrow an appropriate LISP example (or, if you are in hurry, you shoud ask in the LISP forum).  

 

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 10 of 12
MMcCall402
in reply to: j.palmeL29YX

It appears like it just as Jürgen says, dynamic blocks are only 2D.   I didn't pay enough attention to the values I was getting.

 

If you were using Civil 3D this would be very easy.  A simple slope label on a line object, done.

 

I was toying around with a dimension to see if it was possible to put a field in the dimension text what could access the start and end z values of the dimension.  No luck.   I did notice that you could put in a field for those properties of an associated line and calculate its slope and the dimension would follow the line because it was an associated dimension.

 

 

Mark Mccall 
CAD Mangler



Hammer Land Engineering


Linkedin

Message 11 of 12
AlexKDJ24
in reply to: MMcCall402

Jürgen and Mark,

Thank you very much for your help. I was coming to the conclusion that perhaps it was only 2d.

But Jürgen, I would be very grateful if you could assist with a Lisp routine, that would work just as well. I have looked at lisp routines before, and use a few (premade) ones regularly, but am no good at coding.

 

thanks

Alex

Message 12 of 12
j.palmeL29YX
in reply to: AlexKDJ24


@AlexKDJ24 wrote:

 

I would be very grateful if you could assist with a Lisp routine, 


  

Attached a first rough draft of a LISP (after loading the .lsp file start with SLOPE). 

 

 

Obviously you calculate the X in the slope 1:X with horizontal distance divided by the vertical distance of the both points. I'd do it reciprocal - vertical distance divided by the horizontal distance. But that's your choice. You only need to change the line 

slope_num (/ delta_xy delta_z) 

to

slope_num (/ delta_z delta_xy)

 

 

(and choose an appropriate number of decimals 

slope_str (rtos slope_num 2 0) 

change to 

slope_str (rtos slope_num 2 3). 

 

Of course you can (should) refine this draft to your needs. 

 

 

(defun c:slope (/)
  (setq	p1	  (getpoint "\nFirst point: ")
	p2	  (getpoint "\nSecond point: ")
	p2_	  (list (car p2) (cadr p2) (caddr p1))
	delta_z	  (- (caddr p2) (caddr p1))
	delta_xy  (distance p1 p2_)
	angle_xy  (angle p1 p2_)
	halfway	  (polar p1 angle_xy (/ delta_xy 2))
	slope_num (/ delta_xy delta_z)
	slope_str (rtos slope_num 2 0)
	slope_txt (strcat "1:" slope_str)
  )
  (command "text"
	   "_J"
	   "_BC"
	   halfway
	   3.5
	   (/ (* 180 angle_xy) PI)
	   slope_txt
  )
  (princ)
)

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


”Boost