TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: the7347 on May 08, 2015, 03:29:29 PM
-
Simply I can not get the entity store just after creating it with the command "line". followed by entmake I can do it with (setq ent (entlast)), but it does not work after using the command "line".
Someone has the solution...
or could help to create a line that has the second coordinate as a string, I mean in this way:
this fails, the P2 no is a bad DXF group: (11 . .........
Help please.
-
Take a look at the polar function for getting P2
http://help.autodesk.com/view/CIV3D/2016/ENU/?guid=GUID-6A84BFD3-8788-45B1-AB52-5E83F0C5286E
-
... I can do it with (setq ent (entlast)), but it does not work after using the command "line".
This is not correct, there must be another issue.
BTW: You are using a variable 'min'. This is unwise as there is a Lisp function called 'min'.
-
Take a look at the polar function for getting P2
http://help.autodesk.com/view/CIV3D/2016/ENU/?guid=GUID-6A84BFD3-8788-45B1-AB52-5E83F0C5286E
I can not to use the polar function because I'm using the angle in DDMMSS format as string.
Take a look at the polar function for getting P2
http://help.autodesk.com/view/CIV3D/2016/ENU/?guid=GUID-6A84BFD3-8788-45B1-AB52-5E83F0C5286E
Thanks for the warning, this is just an example I'm using the word "minutes"
Thanks for the quick response
-
Simply I can not get the entity store just after creating it with the command "line". followed by entmake I can do it with (setq ent (entlast)), but it does not work after using the command "line".
Someone has the solution...
or could help to create a line that has the second coordinate as a string, I mean in this way:
this fails, the P2 no is a bad DXF group: (11 . .........
Help please.
You cannot set the variable P2 to a command string because ENTMAKE only accepts a list of numbers representing x y and z. Tombu is correct that you should use the POLAR function to return a real point list.
Also - you will need to convert the Deg / min / sec value to a radians (Hint: Look up the function ANGTOF) for the polar function. See example below::
(setq angInDegress (Angtof (strcat deg "d" min "'" sec "\"") 1) ;convert deg min sec to RADIANS.
(setq p2 (polar p1 angleInDegrees dist))
EDIT: Corrected my Previous Message as ANGTOF already returns radians.
-
Now I have a few problems, I need to determine the coordinates for the hands of relog (ANGDIR 1) and polar does not respect this
The angle is calculated regardless ANGBASE and ANGDIR,
Look the attachment When the angle is 90 degrees
-
The angtof function respects both the ANGBASE and the ANGDIR*. Maybe your problem is caused by a UCS that is not the WCS?
* Note: I use BricsCAD instead of AutoCAD.
(defun c:test
( / dist deg mnt sec pt
) '(0 . "LINE")
11
pt
)
)
)
)
)
-
The angtof function respects both the ANGBASE and the ANGDIR*. Maybe your problem is caused by a UCS that is not the WCS?
* Note: I use BricsCAD instead of AutoCAD.
Confirmed in AutoCAD:
0
0.0
1.5708
_$
(setvar 'angbase
(/ pi
3.0))1.0472
2.61799
1
5.75959
-
I totally agree with what they say, excuse my bad English. I mean I need the angle for polar coordinate start from ANGBASE and clockwise,like the example I gave in the image. But using polar, the angle always starts from the x axis and counterclockwise :/
-
But using polar, the angle always starts from the x axis and counterclockwise :/
That is true. But the angtof function will correctly translate the angle. See the test function in my previous post.
-
But using polar, the angle always starts from the x axis and counterclockwise :/
That is true. But the angtof function will correctly translate the angle. See the test function in my previous post.
As roy has correctly noted, observe the following:
_$
(setvar 'angbase
(/ pi
2.0))1.5708
1
1.5708
1.39626
With ANGBASE set to pi/2 radians (90 degrees), 0.0 rad/deg is in the positive y-axis direction; and with ANGDIR set to 1, angles increase in the clockwise direction.
As you can see from the above console output, angtof respects these system variable settings, with an input of 0.0 returning pi/2 radians or 90 degrees, and a positive angle decreases the angle in radians returned by angtof.
-
I apologize, I did not understand, now works perfectly thanks to the angtof function.
thanks a million :-D
-
No need to apologise - you're welcome!