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

Automatic Xline on line or poly line

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
ishaq03
1276 Views, 12 Replies

Automatic Xline on line or poly line

I need a Create Xline on line and poly line vertex point Automatic with the help of lisp.  Please check my Attached pic to understand my problem.

12 REPLIES 12
Message 2 of 13
tramber
in reply to: ishaq03

Do this :

 VX is the command name. 

 

[EDIT]

 

(defun c:vx (/ *os* obj)
  (setq *os*(getvar "osmode"))(setvar"osmode"0)
  (cond((setq obj(car(entsel"\nPolyline")))
	(command "_xline" "_v")
	(foreach p (mapcar 'cdr(vl-remove-if-not '(lambda(x)(=(car x)10))(entget obj)))
	  (command  p))
	(command)))
  (setvar"osmode"*os*)(princ)
  )

 

 

 

Message 3 of 13
ishaq03
in reply to: tramber

 Thank u Vey much is working Perfectly as I need.

Message 4 of 13
ishaq03
in reply to: ishaq03

I used this code and it give me a lot of help to move my work fast. But I want to request you to modify in the code to give both option on object Horizontal and vertical previously provide code for vertical only on object. Check attached pic now I need horizontal xlines on vertex  

 

 

 

ishaq03_0-1633592896811.png

 

Message 5 of 13
tramber
in reply to: ishaq03

(defun c:hx (/ *os* obj)
  (setq *os*(getvar "osmode"))(setvar"osmode"0)
  (cond((setq obj(car(entsel"\nPolyline")))
	(command "_xline" "_h")
	(foreach p (mapcar 'cdr(vl-remove-if-not '(lambda(x)(=(car x)10))(entget obj)))
	  (command  p))
	(command)))
  (setvar"osmode"*os*)(princ)
  )

What about the Hx version ?

Message 6 of 13
ishaq03
in reply to: tramber

It's good working perfectly but my request to you make a one code for Horizontal and vertical. Means  if user need horizontal on the object code allows to provide Horizontal lines same as vertical. 

Message 7 of 13
tramber
in reply to: ishaq03

In + ? The choice of one, the other, or both ?
The choice each time ?
What would be the dialog ?
Message 8 of 13
ishaq03
in reply to: tramber

The choice will be one as per user need. If we need Horizontal some time and some time we need Vertical on the object.

Message 9 of 13
ishaq03
in reply to: ishaq03

"Kind Reminder"

Message 10 of 13
Kent1Cooper
in reply to: ishaq03


@ishaq03 wrote:

The choice will be one as per user need. If we need Horizontal some time and some time we need Vertical on the object.


It seems simpler to me to have the two commands that have already been defined.  When you want horizontal Xlines, use the HX command, and when you want Vertical ones, use the VX command.  If you build the direction choice into a single command, then every time you use it you need to answer the prompt about which direction the Xlines should go.  Since presumably you know before you start the command which direction you want, just use the appropriate command name, and eliminate the step of answering a direction prompt.

 

But if you really prefer the single command with a direction option, it can certainly be done.

Kent Cooper, AIA
Message 11 of 13
ishaq03
in reply to: Kent1Cooper

yes I prefer single command for Horizontal and vertical,  If possible kindly provide me as soon as possible.

Message 12 of 13
Kent1Cooper
in reply to: ishaq03

Message 1 refers to drawings Xlines at Lines as well as Polyline vertices.  Is that something you would need to do, presumably with an Xline [in whatever direction] through each end of each Line selected?

 

If you want an example of offering such options and retaining one as a default, Search the Customization Forum for CONSTLINES.LSP with its RX command.  It has choices for Horizontal, Vertical, Free direction or any specified angle, and remembers your choice to offer as default on subsequent use.  But it requires you to pick for each one -- automating it to use every vertex of a Polyline or each end of a Line should not be difficult.

Kent Cooper, AIA
Message 13 of 13
ishaq03
in reply to: Kent1Cooper

Kent Cooper, Which Command you suggest me it's not create the xlines on Polyline Vertex Point. I need a Code which can be create xline on Polyline Vertex Horizontal and Vertical as user need. Previously I have been get the VX for vertical and RX for Horizontal just my request is Combined this code and Provide a One Command. 

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report