Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Boundary and Offset with ENTMOD

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
cgentile
922 Views, 7 Replies

Boundary and Offset with ENTMOD

I'm having trouble with this what seems to be simple routine. The goal is to click once inside an area defined by crossing lines/arcs/polygons and have the routine create a boundary on defpoints and an internal offset of it on the specified layer in the routine. I don't get why it's not working correctly. 

 

Any help is appreciated! Thanks.

7 REPLIES 7
Message 2 of 8
Shneuph
in reply to: cgentile

It may help to add your point to the offset command as below.

 

change 

(command "offset" off ent) ;offset

 

to 

(command "offset" off ent pt) ;offset

 

I believe that might get the offset to work but I didn't test thoroughly.

 

BTW.  Typically, avoiding the use of the defpoints layer is recommended.

Message 3 of 8
Kent1Cooper
in reply to: cgentile


@cgentile wrote:

.... The goal is to click once inside an area defined by crossing lines/arcs/polygons and have the routine create a boundary on defpoints and an internal offset of it on the specified layer in the routine. I don't get why it's not working correctly. 

....


It doesn't look like you're completing the Boundary command.  It allows more than one point to be picked, so you need to tell it you're done.  [Also, mine won't accept "-bo", but maybe that's version-dependent.]

(command "_.boundary" pt "")

 

Another way to do the offset, without needing the internal point:

 

(vla-offset (vlax-ename->vla-object (entlast)) (- off))

 

[A positive value at the end goes outside.]

Kent Cooper, AIA
Message 4 of 8
cgentile
in reply to: Kent1Cooper

Thank you Kent and Shneuph, I caught some of these missing pieces as well.

 

I came across another issue. I would like to have the command remember the offset variable defined from the first input. Pretty much so I would just need to click the inside of the boundary and click enter twice. Rather than typing "3" or "6" each time for the offset. I am not familiar with storing variables like this... what is the best route SETENV GETENV?

 

Thanks!

Message 5 of 8
Shneuph
in reply to: cgentile

I use a temporary variable and compare it to the existing one.  There might be better ways.. but this seems to work well for me.

 

(setq tempoff (getdist (strcat "Enter Offset Distance: " (if off (strcat "< " (rtos off) " >  ") "  "))))
  (if (and (/= tempoff off) (and (/= tempoff "") (/= tempoff nil)))
    (setq off tempoff)
    );if

I think this may work for you.

Message 6 of 8
Kent1Cooper
in reply to: cgentile


@cgentile wrote:

.... 

I came across another issue. I would like to have the command remember the offset variable defined from the first input. Pretty much so I would just need to click the inside of the boundary and click enter twice. Rather than typing "3" or "6" each time for the offset. I am not familiar with storing variables like this... what is the best route SETENV GETENV?

....


The SETENV/GETENV approach will let you have a value for such things that is available across multiple drawings, and will survive getting out and back in.  This is an example of a way you can do that [in that case, with multiple values].

 

If you don't need that universality, but are willing to set the distance in each editing session and have it retain that as a default only until you close the drawing, there are simpler ways to do that, too -- do a Search for something like "default" and you'll find a lot of routines.

Kent Cooper, AIA
Message 7 of 8
Kent1Cooper
in reply to: cgentile


@cgentile wrote:

....  I would like to have the command remember the offset variable defined from the first input. Pretty much so I would just need to click the inside of the boundary and click enter twice. Rather than typing "3" or "6" each time for the offset. ....


A further refinement you could incorporate, if you're interested:  Have it report to the User the current Offset distance, and have changing the value of that available as an option.  That way, you don't even need to hit Enter to accept the value each time.  You could just call up the command, and if the distance is what you want, go directly to just a pick in an area, and it will take care of it.  Only if you want a different value than it reports would you type in an option letter to get to where you can change that.  Does that sound worthwhile?

Kent Cooper, AIA
Message 8 of 8
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:

....A further refinement you could incorporate, if you're interested:  Have it report to the User the current Offset distance, and have changing the value of that available as an option.  That way, you don't even need to hit Enter to accept the value each time.  You could just call up the command, and if the distance is what you want, go directly to just a pick in an area, and it will take care of it.  Only if you want a different value than it reports would you type in an option letter to get to where you can change that.  Does that sound worthwhile?


Something like this, if you use a global variable [here called *OD*] rather than (setenv)/(getenv):

 

  (if (not *OD*) (setq *OD* 3)); initial default value [change as desired]
  (prompt
    (strcat "\nCurrent Offset Distance = " (rtos *OD*) ".")
  ); prompt
  (initget "Distance")
  (while
    (not ; User typed option letter rather than picked point
      (listp
        (setq pt1 (getpoint "\nPoint inside area or [Distance]: "))
      ); listp
    ); not
    (setq *OD* (getdist "\nOffset Distance: "))
    (initget "Distance"); for next-time-through prompt
  ); while [will stop if point picked -- go on to do Boundary, etc.]

 

In any case, use (getdist) rather than your original (getstring), because the User will have the option to designate the distance by picking two points on-screen if they prefer, as well as to type in a value in any valid kind of distance entry, such as feet and inches and fractions, which (atof) would mistranslate.

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost