Dit is de link:
https://chat.openai.com/chat
Wat kan het:
De site kan van alles beantwoorden maar ook code schrijven.
Hier een voorbeeld:
Mijn vraag:
please write a vlisp code to draw a line in autocad
AI antwoord:
(defun c:line ( / p1 p2)
(setq p1 (getpoint "Specify first point: "))
(setq p2 (getpoint p1 "Specify second point: "))
(command "line" p1 p2)
(princ)
)
CiteerThis code defines a function called c:line that prompts the user to specify the starting and ending points of the line. It then uses the line command to draw the line between these two points.
To use this code in AutoCAD, you can type it in the command line and press Enter to run it. This will define the c:line function and make it available for use in your AutoCAD drawing. To draw a line, simply type line in the command line and press Enter. This will run the c:line function and prompt you to specify the starting and ending points of the line. Once you have specified these points, the line will be drawn in your AutoCAD drawing.
Keep in mind that this code is just an example and can be modified and expanded upon to suit your specific needs and preferences. For more information and examples of VLISP code, you can check out the AutoCAD documentation or search online for VLISP tutorials and examples.
Nog een voorbeeld:
please write a vba code to draw a line in autocad
AI antwoord:
Sub DrawLine()
Dim p1 As Variant
Dim p2 As Variant
' Prompt the user to specify the starting and ending points of the line
p1 = ThisDrawing.Utility.GetPoint("Specify first point: ")
p2 = ThisDrawing.Utility.GetPoint("Specify second point: ", p1)
' Draw the line between the specified points
ThisDrawing.ModelSpace.AddLine p1, p2
End Sub
CiteerThis code defines a subroutine called DrawLine that prompts the user to specify the starting and ending points of the line. It then uses the AddLine method to draw the line between these two points in the current drawing.
To use this code in AutoCAD, you can open the VBA editor and paste the code into a new module. This will define the DrawLine subroutine and make it available for use in your AutoCAD drawing. To draw a line, simply run the DrawLine subroutine in the VBA editor. This will prompt you to specify the starting and ending points of the line. Once you have specified these points, the line will be drawn in your AutoCAD drawing.
Keep in mind that this code is just an example and can be modified and expanded upon to suit your specific needs and preferences. For more information and examples of VBA code, you can check out the AutoCAD documentation or search online for VBA tutorials and examples.
Nog een:
please write a C# code to draw a line in autocad
AI:
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
namespace DrawLine
{
public class Line
{
[CommandMethod("DrawLine")]
public void DrawLine()
{
// Get the current document and database
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
// Start a transaction
using (Transaction trans = db.TransactionManager.StartTransaction())
{
// Open the Block table for read
BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
// Open the Block table record Model space for write
BlockTableRecord btr = trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
// Create a new line
Line line = new Line(new Point3d(0, 0, 0), new Point3d(10, 10, 0));
// Add the line to the block table record
btr.AppendEntity(line);
// Save the new object to the database
trans.AddNewlyCreatedDBObject(line, true);
// Save the changes and dispose of the transaction
trans.Commit();
}
}
}
}
CiteerThis code defines a class called Line that contains a method called DrawLine. The DrawLine method creates a new Line object using the Point3d constructor and adds it to the current drawing.
To use this code in AutoCAD, you can compile it into a .NET assembly and load it into AutoCAD using the NETLOAD command. This will define the DrawLine command and make it available for use in your AutoCAD drawing. To draw a line, simply type DrawLine in the command line and press Enter. This will run the DrawLine command and draw a line in your AutoCAD drawing.
Keep in mind that this code is just an example and can be modified and expanded upon to suit your specific needs and preferences. For more information and examples of C# code, you can check out the AutoCAD documentation or search online for C# tutorials and examples.
Dit is echt wel heel indrukwekkend! :shock:
Probeer eens een complexere taak...
Sinds toen...
Het is alweer ff geleden maar veel verbeterd.
Code schrijven met AI als assistent... code wordt zelfs voorgesteld/aangevuld.
Ik gebruik voor LSP 'VS Code' met Copilot van GitHub, echt handig.