AutoCAD for Mac Forum
Welcome to Autodesk’s AutoCAD for Mac Forums. Share your knowledge, ask questions, and explore popular AutoCAD for Mac topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Snap from Lisp

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
bedyr
1185 Views, 17 Replies

Snap from Lisp

Hi,

 

I am using a pollyline lisp and it is fillet also. I want to add this lisp snap _from but I dont know how can I do. Anybody can help ?

 

 

(defun c:PF (/ pt eLast ent) 
(setvar "PLINEWID" 0.2)
(if 
(setq pt (getpoint "\nSpecify start point: "))
(progn
(setq eLast (entlast))
(command "_.pline" "_non" pt)
(while 
(= 1 (logand (getvar 'cmdactive) 1))
(princ "\nSpecify next point: ")
(command PAUSE)
)
(or 
(equal eLast (setq ent (entlast)))
(command "_.fillet" "_P" ent)
(setvar "PLINEWID" 0)
)
)
)
(princ)
)
17 REPLIES 17
Message 2 of 18
maxim_k
in reply to: bedyr

Hi Bedir,

Do you want to use "from" OSNAP override for all points (vertices) you pick to create polyline?

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 3 of 18
bedyr
in reply to: maxim_k

I want to draw a polyline along the other(wall). I am doing that offset and fillet command and this is taking my all time. 

Message 4 of 18
maxim_k
in reply to: bedyr

Isn't it easier to create macro:

 

^C^C_OFFSET;5 \\;_FILLET;_r;5;_FILLET;_P;_L

 

with CUI command. In the example above polyline will be offset by 5 units and filleted with radius 5.

 2019-08-16_17-56-43.png

 

 

 

and assign it to a button on Toolsets palette, or to menu item (with this option you will be able to assign shortcut for this operation).

 

The difficulty is that FROM is not an object snap, but rather a Command Modifier, which works differently then standard OSNAP.

 


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 5 of 18
bedyr
in reply to: maxim_k

Thank you maxim but it is not working like I want. The wall not just polyline it can be also line. I want to do snap from. 

Message 6 of 18
maxim_k
in reply to: bedyr

How do you want to specify offset inside FROM command modifier? Do you want to type it from keyboard (you need to specify offset distance and angle), or you prefer to specify it on screen as you showed in screencast?
Actually I have my handmade AutoLISP routine, which creates polyline the same way as PLINE command.
I created it without using PLINE command inside (you are using PLINE command inside your routine).
I think it is possible to put a couple lines of code to it in order to add FROM command modifier to it.

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 7 of 18
bedyr
in reply to: maxim_k

At first command begin first point and ask me that where _from  and then automatically enter ofset. Make this a loop.

Message 8 of 18
maxim_k
in reply to: bedyr

>>>>then automatically enter ofset
You can set offset distance inside routine in order not to specify it each time. But what about the direction of offset? It seems to me you have to specify it for each point separately during creation.

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 9 of 18
bedyr
in reply to: maxim_k

No it will ask me where _from and I will give it offset side.

Message 10 of 18
maxim_k
in reply to: bedyr

I'm talking about offset direction, which means not only side, but also an angle in construction plane. Or do you mean the new line (each segment of new polyline) should be parallel to existing line (segment of existing polyline)?
I have found a topic similar to your question:
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-draw-a-polyline-parallel-to-a...
BTW, you may ask your question on AutoCAD Customization Forum:
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130
But you have to mention that you are using AutoCAD for Mac and can use only vanilla AutoLISP - Visual Lisp is not available in AC for Mac.

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 11 of 18
bedyr
in reply to: maxim_k

I want to do like that. It is in autocad utility and I want to do on autocad.

 

https://knowledge.autodesk.com/support/autocad-utility-design/learn-explore/caas/CloudHelp/cloudhelp...

Message 12 of 18
maxim_k
in reply to: bedyr

Multiline?

I attached multiline library file "test.mln" (inside ZIP archive) with TEST multiline style, which has only one line. If you set justification to ZERO, scale to 1 it will be drawn with 5 units offset from the points you will pick in the drawing.

 

Here:

https://forums.autodesk.com/t5/autocad-for-mac-forum/how-do-i-attach-a-mln-file-to-autocad-2018-for-...

you can find info on how to load .mln file in AutoCAD for Mac.


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 13 of 18
bedyr
in reply to: maxim_k

This is awesome but it is just draw one way direction. how can I change still drawing side duration time?

Message 14 of 18
maxim_k
in reply to: bedyr

If you want to draw line on opposite side of the "path" just change scale from 1 to -1, or change direction of picking point on "path".

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 15 of 18
bedyr
in reply to: maxim_k

it is difficult do that. when drawing I cant change side.

Message 16 of 18
maxim_k
in reply to: bedyr

>>>>>it is difficult do that.
Is it really difficult? I'm still don't know exactly all functionality of AutoLISP routine (for instance, you didn't mention the side change while you draw, when you originally described the functionality you need). But let's look at side changing closer:

1/ Multiline option.
You can create two macros - one for scale 1 and another for scale -1, and assign them to buttons on ToolSets palette.
Now you when you want to change side, you pick last point on the "path", then pick on button which will cancel current command, call it again and change scale - you only need to specify start point.
So with Multiline we have two steps (pick on button on ToolSets palette and pick start point).

2/ AutoLISP option.
Suppose, you have AutoLISP routine which have all functionality you need.
When you want to change side, you pick last point on the "path", now you shall let now to routine that you want to change side, so you have to type an option at the command prompt and hit Return (two steps). Now you must somehow to show on which side you want to continue creating the line - pick on side with mouse (and that is the third step)

So when you want to change side:
- with Multiline option you have to perform two actions (steps)
- with AutoLISP option you have to perform three actions (steps)

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 17 of 18
bedyr
in reply to: maxim_k

I want to like that lisp but in this lisp I couldnt change offset direction. Can we change this for two options?
I will click a point and with mouse action choose offset direction.

(defun c:PF (/ dd mm p1 p2 is nk1 nk2) (setq dd t) (setq mm 5) (setq obj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument obj)) (setq ms (vla-get-ModelSpace doc)) (if (setq p1 (getpoint "\nFirstPoint:")) (progn (while dd (if (setq p2 (getpoint p1 "\nOtherPoint:")) (progn (setq ss (ssget "c" p2 p2)) (if ss (setq is -) (setq is +) ) (setq nk1 p1 nk2 (polar p1 (angle p1 p2) (is (distance p1 p2) mm)) ) (vla-addline ms (vlax-3d-point nk1) (vlax-3d-point nk2)) (setq p1 nk2) ) (progn (setq dd nil) ) ) ) ) ) (princ) )

 

Message 18 of 18
maxim_k
in reply to: bedyr

AutoLISP code you posted here will not work in AC for Mac because it contains VLAX- functions.
Ans I see your request in another post about converting the routine to "vanilla" AutoLISP.

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report