Jump to content

Draw slope lines


Recommended Posts

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • BIGAL

    2

  • marko_ribar

    2

  • robert06

    2

  • halam

    1

Top Posters In This Topic

Popular Posts

Allows user to draw slope lines. SLOPE-LINE.LSP

Posted Images

I wrote something similar in VBA. I used "intersectwith" method but had a problem with embankment with curvature bigger than 90deg. (I know what problem it is and how to solve it but don't have time to wrote it ;/) does it work in yours code?

...and what will happen if bottom slope will be shorter than upper? ;)

Link to post
Share on other sites
  • 5 months later...
  • 1 month later...
  • 4 months later...
  • 7 months later...
  • 3 months later...

i cant use this lsp on my map 3d 2010. i try with 2 pline (and 2 spline), but i cant. im taking this report "; error: no function definition: VLAX-ENAME->VLA-OBJECT"

 

Pls Help Me!!

Link to post
Share on other sites
i cant use this lsp on my map 3d 2010. i try with 2 pline (and 2 spline), but i cant. im taking this report "; error: no function definition: VLAX-ENAME->VLA-OBJECT"

 

Pls Help Me!!

add (vl-load-com) to the top of the code.

Link to post
Share on other sites
teknomatika

Excellent. For my use afstand changed the variable to a real value.

Allows greater freedom in the scale factor.

It is much like another routine dtal.vlx

 

(setq afstand (getreal "\ nLine slope distance:"))

 

DTAL.zip

Link to post
Share on other sites
  • 1 year later...
  • 1 year later...
  • 2 months later...
robert06

Hi,

What should be changed in slope-line.lsp to have the second tick 30% in length of the first one not 50%.

 

thanks!

Link to post
Share on other sites
marko_ribar

Look into red comment :

 

(defun c:slope-line (/            is-on-pl?    talud_boven
                    talud_onder  afstand      afstand_totaal
                    count        p1           p2
                    kleur
                   )

 (defun is-on-pl? (ename pkt /)
   (vl-catch-all-apply
     'vlax-curve-getdistatpoint
     (list
       ename
       pkt
     ) ;_ end of list
   ) ;_ end of vlax-curve-getdistatpoint
   pkt
 ) ;_ end defun

 (vl-load-com)

 (if (and (setq talud_boven (car (entsel "\nSelect top slope: ")))
          (setq talud_onder (car (entsel "\nSelect bottom slope: ")))
          (setq afstand (getdist "\nLine slope distance:"))
          (setq kleur (acad_colordlg )
     ) ;_ end of and

   (progn
     (setq afstand_totaal 0)
     (setq count 0)
     (setq p1 (vlax-curve-getstartpoint
                talud_boven
              ) ;_ end of vlax-curve-getstartpoint
     ) ;_ end of setq
     (while p1
       (if (equal (/ count 2.0) (fix (/ count 2.0)) 0.001)
         (setq p2
                (vlax-curve-getclosestpointto
                  talud_onder
                  p1
                ) ;_ end of vlax-curve-getclosestpointto
         ) ;_ end of setq
         (setq
           p2 (mapcar '(lambda (x) (/ x 2)) [color=red];;; Change (/ x 2) to (* x 0.3) for 30% of distances ;;;[/color]
                      (mapcar '+
                              p1
                              (vlax-curve-getclosestpointto
                                talud_onder
                                p1
                              ) ;_ end of vlax-curve-getclosestpointto
                      ) ;_ end of mapcar
              ) ;_ end of mapcar
         ) ;_ end of setq
       ) ;_ end of if
       (entmake
         (list '(0 . "LINE")
               (cons 10 p1)
               (cons 11 p2)
                                       ;'(62 . 1) ; standaard kleur
               (cons 62 kleur)         ; kleur dia dialog instellen

         ) ;_ end of list
       ) ;_ end of entmake
       (if (not (vl-catch-all-error-p
                  (setq
                    p1
                     (is-on-pl?
                       talud_boven
                       (vl-catch-all-apply
                         'vlax-curve-getpointatdist
                         (list talud_boven
                               (if (<
                                     (setq afstand_totaal
                                            (+ afstand_totaal afstand)
                                     )
                                     (vlax-curve-getdistatpoint
                                       talud_boven
                                       (vlax-curve-getendpoint talud_boven)
                                     )
                                   )
                                 afstand_totaal
                                 nil
                               ) ;_ end of if
                         ) ;_ end of list
                       ) ;_ end of vl-catch-all-apply
                     ) ;_ end of is-on-pl?
                  ) ;_ end of setq
                ) ;_ end of vl-catch-all-error-p
           ) ;_ end of not
         p1
         (setq p1 nil)
       ) ;_ end of if
       (setq count (1+ count))
     ) ;_ end of while
   ) ;_ end of progn
 ) ;_ end of if
 (princ)
) ;_ end of defun

 

HTH, M.R.

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