Jump to content

Self adjusting Attribute values based on point along curve


Recommended Posts

Posted

Morning Everyone,

 

Was hoping someone could help me out a little bit with something.

I am more looking for an answer to "Can this be done".

 

What I am looking for is to create a lisp that has a self adjusting attribute value.
This value would be based on a few factors. I think the best way to describe what I am looking for is to show an image and explain that way.
image.thumb.png.d40e83a3e2eeabb84d17186680dda1a3.png

 

Point A & B would be given points (Elevation heights) and also fixed in place.

Slope to A & B could be anywhere between 2% to 5%.

Point C is the value I need returned along that curved polyline.

This much I can do. Its a bit tricky and probably needs some code updates, but I have it working.

What I am looking to add is something like this....

Give the user the option to LOCK a Slope at a percentage. [Lock Slope] Then [Lock Left Slope][Lock Right Slope][None]

Once a slope is locked, I would like the user to be able  to drag Point C to their desired location, with the number for Point C and the opposite slope being updated as point C is moved along the path.

I have seen Lee Mac's Object Align lisp and know about the vlax-Curve functions that can do the "Move Point C along that path, get the distance From point A to Point C along a curve etc etc. SO I can figure out how to do the math and get the numbers.
What I havent found is whether or not Attributes can be dynamically updated values or not.

Has anyone done anything like this before?

Thanks

Posted

You can get the angle of a point along a pline, never tried in arcs.

Try this, not really tested.

(defun alg-ang (obj pnt)
  (angle '(0. 0. 0.)
     (vlax-curve-getfirstderiv
       obj
       (vlax-curve-getparamatpoint
         obj
         pnt
       )
     )
  )
)

(setq obj (vlax-ename->vla-object (car  (entsel "Pick obj"))))
(setvar 'osmode 512) ; nearest for testing

(while (setq pt (getpoint "\npick point on pline"))
(princ (setq ang (alg-ang obj pt)))
)

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...