cart: empty [ Login ]

Copy an area of a model into another model

< previous  1 2 3  next > 
Wout
3/25/2019 3:23 PM
It's here. There's no example, but should be pretty straightforward. - Wout
Kai
3/26/2019 8:58 AM
Hello, there are troubles with including the method "GetEntitiesInRectangle". Please have a look at the attached file. Ist there a dll or a namespace missing? Here my source code:
C# Code:
GraphicsConfig config = new GraphicsConfig(); Matrix4D transformation = new Matrix4D(); Rectangle2D rectangle = new Rectangle2D(); EntityFilterDelegate filterDelegate = new EntityFilterDelegate(); IList<RenderedEntityInfo> liEntityInfos = new List<RenderedEntityInfo>(); liEntityInfos = GetEntitiesInRectangle(model, model.Layouts, model.Entities, config, transformation, rectangle, filterDelegate);
Can You help me? Thank You very much.
GetEntitiesRectangle.jpg
Wout
3/26/2019 10:56 AM
It's a method of class SelectInteractor, like I've written. - Wout
Kai
3/26/2019 11:13 AM
Hallo, Gut, ich habe die Klasse gefunden. Using Direktive "using WW.Cad.Actions;" fehlte. Entschuldigung, mein Fehler. Und jetzt suche ich nach den Parametern der folgenden Methode: [csharp] EntityFilterDelegate filterDelegate = new EntityFilterDelegate (); [/ csharp] Morgen werde ich weiter arbeiten. Danke dir.
Kai
3/27/2019 7:39 AM
Now in english! Hello, Good, I found the class. Using directive "using WW.Cad.Actions;" was missing. Sorry my fault. And now I'm looking for the parameters of the following method:
C# Code:
EntityFilterDelegate filterDelegate = new EntityFilterDelegate (); [/ csharp] Can You help me with the parameters of following method? DrawContext drContext = new ???; DxfEntity entity = new ???; Here my source code: [csharp]if (sBasicMake.HeightPosFpTeilTab.Length > 1) { GraphicsConfig config = new GraphicsConfig(); Matrix4D transformation = new Matrix4D(); DxfLayout layout = new DxfLayout(); DrawContext drContext = new ???; DxfEntity entity = new ???; EntityFilterDelegate filterDelegate = new EntityFilterDelegate(drContext, entity); IList<RenderedEntityInfo> liEntityInfos; for (int i = 0; i < sBasicMake.HeightPosFpTeilTab.Length; i++) { //Model vom Basismodel clonen, Dateinamen (für *dxf) im Model definieren und der Map hinzufügen strTemp = String.Format("{0}_{1}", ConfigurationManager.AppSettings.Get("FronplattenTeilNr"), i + 1); MyModel addmodel = MyModel.CloneNewModel(model, strTemp); strTemp = string.Format("Fp_{0}", i + 1); mapModel.Add(strTemp, addmodel); model1 = mapModel[strTemp]; liEntityInfos = new List<RenderedEntityInfo>(); liEntityInfos = SelectInteractor.GetEntitiesInRectangle(model, layout, model.Entities, config, transformation, rectangle[i], filterDelegate); } }
Thank you.
Kai
3/27/2019 9:58 AM
Hello, now I define the parameter "filterDelegate" with a null pointer. And there is another problem with initialization the parameter "layout". I don´t know what´s happend this. A try catch is landing in the catch exeption with following message as output: -> The object reference was not set to an object instance. Here is my source code:
C# Code:
if (sBasicMake.HeightPosFpTeilTab.Length > 1) { try { GraphicsConfig config = new GraphicsConfig(); Matrix4D transformation = new Matrix4D(); DxfLayout layout = new DxfLayout("TestLayout"); layout.SetupDefaultIfNoViewportsPresent(); IList<RenderedEntityInfo> liEntityInfos; for (int i = 0; i < sBasicMake.HeightPosFpTeilTab.Length; i++) { //Model vom Basismodel clonen, Dateinamen (für *dxf) im Model definieren und der Map hinzufügen strTemp = String.Format("{0}_{1}", ConfigurationManager.AppSettings.Get("FronplattenTeilNr"), i + 1); MyModel addmodel = MyModel.CloneNewModel(model, strTemp); strTemp = string.Format("Fp_{0}", i + 1); mapModel.Add(strTemp, addmodel); model1 = mapModel[strTemp]; liEntityInfos = new List<RenderedEntityInfo>(); liEntityInfos = SelectInteractor.GetEntitiesInRectangle(model, layout, model.Entities, config, transformation, rectangle[i], null); } } catch (Exception e) { strMsgTemp = string.Format("Systemausgabe: {0}", e.Message); } }
See also the attached file. It´s a screen shoot while the error accoures. Can You help me? Thank You very much.
DxfLayout.jpg
Kai
4/17/2019 12:39 PM
Hello, The problem still does not work. I use the method: [csharp] liEntityInfos = SelectInteractor.GetEntitiesInRectangle (Model, Layout, Model.Entities, Configuration, Transformation, Rectangle [i], Null); [/ csharp] By calling the method of class DxfLayout [csharp] layout.SetupDefaultIfNoViewportsPresent (); [/ csharp] The program crashes. Please see previous post from me. What can I do to get the program up and running? Thanks for your help.
Wout
4/17/2019 1:28 PM
You must pass a filter delegate that's not null. It can be something simple as:
C# Code:
EntityFilterDelegate filter = (context, entity) => true;
- Wout
Kai
4/18/2019 5:56 AM
Hello, that does not work either. Now there is a mistake in this part. [csharp] DrawContext context = new DrawContext.Wireframe.ModelSpace (model1, config, transformation); EntityFilterDelegate filter = (context, entity) => true; [/ csharp] Error Code: CS0136 C # A local or a parameter named 'context' can not be declared in this scope because this name is used in a surrounding local space to define a local member or parameter Do I have to call the method for each entity in a foreach loop? [csharp] liEntityInfos = SelectInteractor.GetEntitiesInRectangle (Model, Layout, Model.Entities, Configuration, Transformation, Rectangle [i], Filter); [/ csharp] Can you show me an example that works? Thanks for your help.
Kai
4/18/2019 9:16 AM
Hello, Everything I try to do does not work. Is there a way to find out which X, Y coordinate the entity is referenced to? If I know the position of the entity, it's easy to clone it into another model. If this is not the right way, I understand at least what I do. [Csharp] foreach (DxfEntity entity in model.Entities) { // Here I need the X, Y coordinate of the entity. entity. ??????????? } [/ csharp] Thanks for your help
< previous  1 2 3  next >