-2
Good morning, I have a problem in a CAD application where it shows the following error:
CS1729 error: "Commandmethodattribute" does not contain a constructor that accepts 0 arguments
1- AUTODESK.AUTOCAD.RUNTIME
using System;
namespace Autodesk.AutoCAD.Runtime
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class CommandMethodAttribute : Attribute, ICommandLineCallable
{
public CommandMethodAttribute(string globalName);
public CommandMethodAttribute(string globalName, CommandFlags flags);
public CommandMethodAttribute(string groupName, string globalName, CommandFlags flags);
public CommandMethodAttribute(string groupName, string globalName, string localizedNameId, CommandFlags flags);
public CommandMethodAttribute(string groupName, string globalName, string localizedNameId, CommandFlags flags, Type contextMenuExtensionType);
public CommandMethodAttribute(string groupName, string globalName, string localizedNameId, CommandFlags flags, string helpTopic);
public CommandMethodAttribute(string groupName, string globalName, string localizedNameId, CommandFlags flags, Type contextMenuExtensionType, string helpFileName, string helpTopic);
public virtual string HelpTopic { get; }
public virtual string HelpFileName { get; }
public virtual Type ContextMenuExtensionType { get; }
public virtual CommandFlags Flags { get; }
public virtual string GroupName { get; }
public virtual string LocalizedNameId { get; }
public virtual string GlobalName { get; }
}
}
2 - MYCOMMANDS
using Autodesk.AutoCAD.Runtime;
using Linq2Autocad;
namespace Posteamento
{
public class MyCommands
{
[CommandMethod] // Aqui ocorre o erro.
public void Esforcos()
{
using (AcadDatabase acadDatabase = AcadDatabase.DoDocumentoAtual())
{
try
{
new Rede(Escolhe.Polyline("\nEscolha a rede"), (IDesenha) acadDatabase.Desenhador()).InsereEsforcos(6);
}
catch
{
}
}
}
[CommandMethod]// Aqui ocorre o erro.
public void EsforcosSem()
{
using (AcadDatabase acadDatabase = AcadDatabase.DoDocumentoAtual())
{
try
{
new Rede(Escolhe.Polyline("\nEscolha a rede"), (IDesenha) acadDatabase.Desenhador()).InsereEsforcos();
}
catch
{
}
}
}
[CommandMethod]// Aqui ocorre o erro.
public void InsereChamada()
{
using (AcadDatabase acadDatabase = AcadDatabase.DoDocumentoAtual())
{
try
{
new Rede(Escolhe.Polyline("\nEscolha a rede"), (IDesenha) acadDatabase.Desenhador()).InsereChamada();
}
catch
{
}
}
}
}
}
PS: I’m not in the area of computer science, I’m a designer and this application calculates the results of efforts between poles of an electrical network. I want to change because currently it performs the calculations with cables of 35mm² and need to change to another cable in order to expedite the service in the office. I do not know if only with this information it would be possible to know how to correct the error.
Thank you very much!
if you read the message, it wouldn’t just create a constructor without parameters? "I’m not a computer guy" I appreciate the idea of trying to solve but it wouldn’t be easier to contact a professional to resolve this?
– Ricardo Pontual
This constructor you say ...would this be "Autodesk.AutoCAD.Runtime"? If so, it would not need these parameters for correct execution of it or the fact that it does not have these parameters does not interfere if all functions are being performed by other parts of the application .(sorry for the silly question)... As for "wouldn’t it be easier to contact a professional to resolve this?" ... the initial idea was just to enter and replace the table of 35mm² by the one we need and compile again, but the fact that maybe it is an older application if I’m not mistaken 2016... There were some errors
– Danilo Soares
And thank you for the reply !!
– Danilo Soares
and how I would make this constructor without parameters ?
– Danilo Soares