修复窗口大小问题
This commit is contained in:
@@ -29,9 +29,9 @@ namespace Szmedi.RvKits.Modeling
|
||||
{
|
||||
ProfileFamilyTypesView.Filter = obj =>
|
||||
{
|
||||
if (obj is FamilySymbol fs)
|
||||
if (obj is WrapperSymbol ws)
|
||||
{
|
||||
return fs.Name.Contains(value) || fs.FamilyName.Contains(value);
|
||||
return ws.FullName.Contains(value);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@@ -46,21 +46,41 @@ namespace Szmedi.RvKits.Modeling
|
||||
{
|
||||
FamilyTypesView.Filter = obj =>
|
||||
{
|
||||
if (obj is FamilySymbol fs)
|
||||
if (obj is WrapperSymbol ws)
|
||||
{
|
||||
return fs.Name.Contains(value) || fs.FamilyName.Contains(value);
|
||||
return ws.FullName.Contains(value);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
FamilyTypesView.Refresh();
|
||||
}
|
||||
}
|
||||
[ObservableProperty]
|
||||
private string searchMaterialText;
|
||||
|
||||
partial void OnSearchMaterialTextChanged(string value)
|
||||
{
|
||||
|
||||
if (Materials != null)
|
||||
{
|
||||
MaterialsView.Filter = obj =>
|
||||
{
|
||||
if (obj is Material mat)
|
||||
{
|
||||
return mat.Name.Contains(value);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
MaterialsView.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
private CenterCurveType centerCurveType;
|
||||
|
||||
[ObservableProperty]
|
||||
private List<FamilySymbol> familyTypes;
|
||||
public partial List<WrapperSymbol> FamilyTypes { get; set; }
|
||||
|
||||
private readonly ActionEventHandler handler;
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
@@ -106,21 +126,21 @@ namespace Szmedi.RvKits.Modeling
|
||||
private System.Windows.Media.ImageSource previewImage = Resources.TrackPic.ToBitmapSource();
|
||||
|
||||
[ObservableProperty]
|
||||
private List<FamilySymbol> profileFamilyTypes;
|
||||
|
||||
public partial List<WrapperSymbol> ProfileFamilyTypes { get; set; }
|
||||
public ICollectionView ProfileFamilyTypesView { get; set; }
|
||||
public ICollectionView FamilyTypesView { get; set; }
|
||||
public ICollectionView MaterialsView { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
private FamilySymbol selectedFamilyType;
|
||||
public partial WrapperSymbol SelectedFamilyType { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private Material selectedMaterial;
|
||||
public partial Material SelectedMaterial { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(CreateTrackCommand))]
|
||||
private FamilySymbol selectedProfileFamilyType;
|
||||
public partial WrapperSymbol SelectedProfileFamilyType { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "不可为空")]
|
||||
[IsNumeric]
|
||||
@@ -132,11 +152,11 @@ namespace Szmedi.RvKits.Modeling
|
||||
public TrackCreatorViewModel(Document doc)
|
||||
{
|
||||
handler = new();
|
||||
profileFamilyTypes = doc.QueryElementsByTypeAndCategory<FamilySymbol>(BuiltInCategory.OST_ProfileFamilies)
|
||||
ProfileFamilyTypes = doc.QueryElementsByTypeAndCategory<FamilySymbol>(BuiltInCategory.OST_ProfileFamilies)
|
||||
.Cast<FamilySymbol>()
|
||||
.OrderBy(n => n.FamilyName)
|
||||
.ToList();
|
||||
familyTypes = doc.QueryElementsByType<FamilySymbol>()
|
||||
.ToList().ConvertAll(s => new WrapperSymbol(s));
|
||||
FamilyTypes = doc.QueryElementsByType<FamilySymbol>()
|
||||
.OfType<FamilySymbol>()
|
||||
.Where(
|
||||
s =>
|
||||
@@ -146,10 +166,11 @@ namespace Szmedi.RvKits.Modeling
|
||||
&& s.Family.FamilyPlacementType == FamilyPlacementType.OneLevelBased
|
||||
)
|
||||
.OrderBy(n => n.FamilyName)
|
||||
.ToList();
|
||||
materials = doc.QueryElementsByType<Material>().OrderBy(n => n.Name).OfType<Material>().ToList();
|
||||
.ToList().ConvertAll(s => new WrapperSymbol(s));
|
||||
Materials = doc.QueryElementsByType<Material>().OrderBy(n => n.Name).OfType<Material>().ToList();
|
||||
ProfileFamilyTypesView = CollectionViewSource.GetDefaultView(ProfileFamilyTypes);
|
||||
FamilyTypesView = CollectionViewSource.GetDefaultView(FamilyTypes);
|
||||
MaterialsView = CollectionViewSource.GetDefaultView(Materials);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -344,9 +365,9 @@ namespace Szmedi.RvKits.Modeling
|
||||
{
|
||||
var horizonSpline = HermiteSpline.Create(planePoints, false);
|
||||
|
||||
if (!SelectedFamilyType.IsActive)
|
||||
if (!SelectedFamilyType.FamilySymbol.IsActive)
|
||||
{
|
||||
SelectedFamilyType.Activate();
|
||||
SelectedFamilyType.FamilySymbol.Activate();
|
||||
}
|
||||
//找到零标高
|
||||
var level = new FilteredElementCollector(doc)
|
||||
@@ -377,7 +398,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
Autodesk.Revit.Creation.FamilyInstanceCreationData data1 =
|
||||
new(
|
||||
locLeft,
|
||||
SelectedFamilyType,
|
||||
SelectedFamilyType.FamilySymbol,
|
||||
referVector,
|
||||
level,
|
||||
Autodesk.Revit.DB.Structure.StructuralType.Footing
|
||||
@@ -388,7 +409,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
Autodesk.Revit.Creation.FamilyInstanceCreationData data =
|
||||
new(
|
||||
loc,
|
||||
SelectedFamilyType,
|
||||
SelectedFamilyType.FamilySymbol,
|
||||
referVector,
|
||||
level,
|
||||
Autodesk.Revit.DB.Structure.StructuralType.Footing
|
||||
@@ -422,7 +443,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
//非刚性变换,会改变原几何,此变换在曲线计算导数时,为非刚性变换,各个basis的模不等于1
|
||||
var transform = spline3D.ComputeDerivatives(0, false);
|
||||
|
||||
familyDocument = doc.EditFamily(SelectedProfileFamilyType.Family);
|
||||
familyDocument = doc.EditFamily(SelectedProfileFamilyType.FamilySymbol.Family);
|
||||
XYZ tangent;
|
||||
XYZ rightBasis;
|
||||
XYZ topBasis;
|
||||
@@ -467,7 +488,7 @@ namespace Szmedi.RvKits.Modeling
|
||||
var fm = familyDocument.FamilyManager;
|
||||
foreach (FamilyType type in fm.Types)
|
||||
{
|
||||
if (type.Name == SelectedProfileFamilyType.Name)
|
||||
if (type.Name == SelectedProfileFamilyType.FamilySymbol.Name)
|
||||
{
|
||||
fm.CurrentType = type;
|
||||
break;
|
||||
@@ -626,6 +647,23 @@ namespace Szmedi.RvKits.Modeling
|
||||
// set { SetProperty(ref spacing, value, true); }
|
||||
//}
|
||||
}
|
||||
public class WrapperSymbol
|
||||
{
|
||||
|
||||
public FamilySymbol FamilySymbol { get; }
|
||||
|
||||
public WrapperSymbol(FamilySymbol familySymbol)
|
||||
{
|
||||
FamilySymbol = familySymbol;
|
||||
}
|
||||
|
||||
public string FullName => $"{FamilySymbol.FamilyName} : {FamilySymbol.Name}";
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{FamilySymbol.FamilyName} : {FamilySymbol.Name}";
|
||||
}
|
||||
}
|
||||
public enum CenterCurveType
|
||||
{
|
||||
ModelCurve,
|
||||
|
||||
Reference in New Issue
Block a user